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
The image for the local service is built in the first command (i.e. build)
The image for the remote service is ignored, since it has not to be built
Second command (up):
The image for the remote service is pulled (because of --pull always)
The image for the local service isn't built (because of --no-build) or pulled (since there's no image: there)
Both containers are started
Actual behaviour
No issues with the first command.
For the second command, Docker tries to pull the local image without having an image: tag defined at all:
$ docker compose up -d --pull always --no-build
[+] Running 2/2
✘ local Error
✔ remote Pulled
Error response from daemon: pull access denied for docker-pull-test-local, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
More testing
Using only the --no-build flag works:
$ docker compose up -d --no-build
[+] Running 2/2
✔ Container docker-pull-test-local-1 Started
✔ Container docker-pull-test-remote-1 Started
Using only the --pull always flag works:
$ docker compose up -d --pull always
[+] Running 1/1
✔ remote Pulled
[+] Building 0.0s (0/0)
[+] Running 3/3
✔ Network docker-pull-test_default Created
✔ Container docker-pull-test-local-1 Started
✔ Container docker-pull-test-remote-1 Started
Interestingly, --no-build --pull policy also fails:
$ docker compose up -d --pull policy --no-build
[+] Running 2/2
✘ local Error
✔ remote Pulled
Error response from daemon: pull access denied for docker-pull-test-local, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Another bug
More interestingly, on another system, the --pull policy flag errors:
The help states it should be working (it is on the other system):
docker compose up -h
Flag shorthand -h has been deprecated, please use --help
Usage: docker compose up [OPTIONS] [SERVICE...]
Create and start containers
Options:
~snip~
--pull string Pull image before running ("always"|"policy"|"never") (default "policy")
~snap~
Environment
I tried to run this on:
Debian 12 (amd64)
Docker version 24.0.7, build afdd53b
Docker Compose version v2.21.0
The system where the --pull policy fails, is this:
macOS 13.5.2 (arm)
Docker version 24.0.6, build ed223bc
Docker Compose version v2.23.0-desktop.1
Compose Version
Docker version 24.0.7, build afdd53b
Docker version 24.0.6, build ed223bc
Running this command sequentially will not change the running container:
$ docker compose up -d --no-build local
[+] Running 1/0
✔ Container docker-pull-test-local-1 Running
$ docker compose up -d --no-build local
[+] Running 1/0
✔ Container docker-pull-test-local-1 Running
$ docker compose up -d --no-build local
[+] Running 1/0
✔ Container docker-pull-test-local-1 Running
However, changing then the parameters, the container is recreated:
$ docker compose up -d --pull always local
[+] Running 1/1
✔ Container docker-pull-test-local-1 Started
Why is it recreated? :/
Funnily enough, now running the same command again results in no recreation again:
$ docker compose up -d --pull always local
[+] Running 1/0
✔ Container docker-pull-test-local-1 Running
$ docker compose up -d --pull always local
[+] Running 1/0
✔ Container docker-pull-test-local-1 Running
$ docker compose up -d --pull always local
[+] Running 1/0
✔ Container docker-pull-test-local-1 Running
Switching CLI args means recreate every time:
$ docker compose up -d --no-build local
[+] Running 1/1
✔ Container docker-pull-test-local-1 Started
$ docker compose up -d --pull always local
[+] Running 1/1
✔ Container docker-pull-test-local-1 Started
$ docker compose up -d --no-build local
[+] Running 1/1
✔ Container docker-pull-test-local-1 Started
$ docker compose up -d --pull always local
[+] Running 1/1
✔ Container docker-pull-test-local-1 Started
Hint: It's the «interactive progress bar». When it states Running, nothing was recreated. However, when it shows Started, it was Recreate & Recreated before.
Description
The Docker compose behaviour when using the
--no-build
and--no-pull
flags in combination will lead to unexpected errors.Steps To Reproduce
Initial position
local
service, which builds an image from the Dockerfile, without anyimage:
tagremote
service, which uses an image from a registryCompose command
Run the following commands:
Expected behaviour
First command (
build
):local
service is built in the first command (i.e.build
)remote
service is ignored, since it has not to be builtSecond command (
up
):remote
service is pulled (because of--pull always
)local
service isn't built (because of--no-build
) or pulled (since there's noimage:
there)Actual behaviour
No issues with the first command.
For the second command, Docker tries to pull the
local
image without having animage:
tag defined at all:More testing
Using only the
--no-build
flag works:Using only the
--pull always
flag works:Interestingly,
--no-build --pull policy
also fails:Another bug
More interestingly, on another system, the
--pull policy
flag errors:The help states it should be working (it is on the other system):
Environment
I tried to run this on:
The system where the
--pull policy
fails, is this:Compose Version
Docker Environment
Anything else?
I've created a repo to demonstrate it: https://github.com/confirm/docker-pull-test
The text was updated successfully, but these errors were encountered: