You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Trying to create a container from a local image (one that is not hosted on any container registry) doesn't work when using WithUseLocalImagesFirst().
Build docker image from local dockerfile and tag it with a name. For example from the root of this repo run the following: docker build -f internal/customer/Dockerfile.worker -t customer-worker .
Execute the integration test here go test -v -run ^TestCustomerServiceIntegrationTestSuite internal/customer/integration-tests/customer/customer_test.go. Which attempts to start the container from the image as follows
The local container is not found and I keep getting the error:
Error: Received unexpected error:
can't start container: can't prepare container: can't pull image: can't pull image: Error response from daemon: pull access denied for customer-worker, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Expected behavior
I expected the container to be created from the local image - however it seems that the container is not even found. After some digging around in gnomock's source code I discovered the functionisExistingLocalImage and after some debugging I realise it's expecting an image named library/customer-worker which Im not sure why it expects it to be named like this? I notice it's using strings.HasSuffix(image, repoTag) - are these parameters the wrong way round? For example, if my image is named "customer-worker:latest" repoTag will be "library/customer-worker:latest" and so strings.HasSuffix(image, repoTag) will always return false - unless the parameters are swapped then this would make sense?
Anyway, as a workaround I tried naming my image "library/customer-worker" and this did indeed allow it to be discovered however now I get a different error
Error: Received unexpected error:
can't start container: container network isn't ready: can't inspect container 5e93d9b5f5eec2764bec9a9aeb92127b58fcd6403fccb3cb48998468248ba342: Error: No such container: 5e93d9b5f5eec2764bec9a9aeb92127b58fcd6403fccb3cb48998468248ba342
Screenshots
If applicable, add screenshots to help explain your problem.
System (please complete the following information):
OS: Mac OS Ventura
Version: 13.1
Docker version: 20.10.21, build baeda1f
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Can you try the fix from #798? With it I managed to create a container using a local image without adding library/ or version tag. I'll wait for your feedback a couple of days before merging it.
Describe the bug
Trying to create a container from a local image (one that is not hosted on any container registry) doesn't work when using
WithUseLocalImagesFirst()
.To Reproduce
Repo: https://github.com/Omar-V2/temporal-coffeeshop/blob/main/internal/customer/integration-tests/customer/customer_test.go
Build docker image from local dockerfile and tag it with a name. For example from the root of this repo run the following:
docker build -f internal/customer/Dockerfile.worker -t customer-worker .
Execute the integration test here
go test -v -run ^TestCustomerServiceIntegrationTestSuite internal/customer/integration-tests/customer/customer_test.go
. Which attempts to start the container from the image as followsExpected behavior
I expected the container to be created from the local image - however it seems that the container is not even found. After some digging around in gnomock's source code I discovered the function
isExistingLocalImage
and after some debugging I realise it's expecting an image namedlibrary/customer-worker
which Im not sure why it expects it to be named like this? I notice it's usingstrings.HasSuffix(image, repoTag)
- are these parameters the wrong way round? For example, if my image is named"customer-worker:latest"
repoTag will be"library/customer-worker:latest"
and sostrings.HasSuffix(image, repoTag)
will always return false - unless the parameters are swapped then this would make sense?Anyway, as a workaround I tried naming my image
"library/customer-worker"
and this did indeed allow it to be discovered however now I get a different errorScreenshots
If applicable, add screenshots to help explain your problem.
System (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: