Home > Software engineering >  docker-compose build behind proxy. failed to solve: rpc error . dial tcp: lookup auth.docker.io. on
docker-compose build behind proxy. failed to solve: rpc error . dial tcp: lookup auth.docker.io. on

Time:09-08

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch anonymous token: Get "https://auth.docker.io/token?scope=repository:library/rockylinux:pull&service=registry.docker.io": dial tcp: lookup auth.docker.io on ipadress.

CodePudding user response:

before docker compose build --no-cache -progress=plain

run this first: docker pull rockylinux:9-minimal

CodePudding user response:

In Docker, actions like pulling images are performed by the Docker daemon and do not use your shell’s environment variables.

When working behind a proxy, apart from configuring your proxy settings within your shell, you need to also configure them in Docker deamon.

To configure proxy in docker deamon, create directory /etc/systemd/system/docker.service.d for Docker proxy settings config file. Then create /etc/systemd/system/docker.service.d/http-proxy.conf with the below contents. Replace proxy_server_host and proxy_server_port with your proxy server's host IP and port respectively.

[Service]
Environment="HTTP_PROXY=http://proxy_server_host:proxy_server_port"
Environment="HTTPS_PROXY=http://proxy_server_host:proxy_server_port"
Environment="NO_PROXY=localhost,127.0.0.1"

Apply the settings and restart docker with the below commands.

sudo systemctl daemon-reload
sudo systemctl restart docker

You can confirm whether the settings have been applied with:

systemctl show --property=Environment docker
  • Related