Open LoSunny opened 10 months ago
Hello @LoSunny
Do you have the same issue when using docker build
?
Did you check your proxy is well configured to work with Docker? You can check the documentation here.
A workaround could be passing the HTTP_PROXY
as a build argument in your command like this docker compose build --build-arg HTTP_PROXY="http://proxy.example.com:3128" .
@glours (UPDATED) No, I don't have the same issue when using docker build
. If you look at the temporary workaround section above, in the successful attempt of docker compose build ...
, step no. 5, it will echo the HTTP_PROXY variable, which states that I have successfully pass the variable through the ~/.docker/config.json
file already. Even if I override it with --build-args
, it produced the same result
If the same issue applies to a plain docker build
then this is not a compose bug. Please report on https://github.com/docker/buildx
@ndeloof This issue does NOT apply to plain docker build
, docker build
will be able to download the metadata, but docker compose
doesn't. In the temporary workaround section, I indeed use docker build
to pull the metadata to cache for docker compose
to resolve it
my bad, I missread your answer - reopened
I can confirm the issue. docker compose pull
uses the proxy, but docker compose build --pull
doesn't
Docker Compose version v2.26.1
Description
The proxy will not be applied when pulled an image (new / old, as long as it's metadata isn't in cache)
Steps To Reproduce
Error reproduce
docker-compose.yml
Dockerfile
docker compose build
Temporary workaround to solve the issue
Aim: Load the metadata in cache Here is my file structure
docker pull
will use the proxy, we can force it to pull the image, i.e.docker pull <your image>
docker compose build
and it will return success Full sample log1 [test internal] load .dockerignore
1 transferring context: 2B done
1 DONE 0.1s
2 [test internal] load build definition from Dockerfile
2 transferring dockerfile: 144B done
2 DONE 0.1s
3 [test internal] load metadata for docker.io/library/python:3
3 ERROR: failed to authorize: DeadlineExceeded: failed to fetch anonymous token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fpython%3Apull&service=registry.docker.io": dial tcp 3.219.239.5:443: i/o timeout
[admin@wazuh-01 tmp]$ sudo docker pull python:3 3: Pulling from library/python Digest: sha256:31ceea009f42df76371a8fb94fa191f988a25847a228dbeac35b6f8d2518a6ef Status: Image is up to date for python:3 docker.io/library/python:3
[admin@wazuh-01 tmp]$ sudo docker compose build --progress=plain --no-cache --progress is a global compose flag, better use `docker compose --progress xx build ...#0 building with "default" instance using docker driver
1 [test internal] load build definition from Dockerfile
1 transferring dockerfile: 87B 0.0s
1 transferring dockerfile: 144B 0.0s done
1 DONE 0.1s
2 [test internal] load .dockerignore
2 transferring context: 2B done
2 DONE 0.1s
3 [test internal] load metadata for docker.io/library/python:3
3 DONE 0.0s
4 [test 1/2] FROM docker.io/library/python:3
4 DONE 0.4s
5 [test 2/2] RUN echo "HTTP_PROXY=$HTTP_PROXY"
5 0.410 HTTP_PROXY=http://192.168.140.92:8118
5 DONE 0.5s
6 [test] exporting to image
6 exporting layers 0.0s done
6 writing image sha256:359694de5b1dd714c235746eccbeab512695cd486ff80fe10deff3a5274c32e1 done
6 naming to docker.io/library/tmp-test 0.0s done
6 DONE 0.1s
For simplicity, all commands will be referenced by
docker compose ...
instead of/root/.docker/cli-plugins/docker-compose-linux-x86_64 ...
Docker Environment
Anything else?
No response