How docker uses proxy

There are three situations for adding an agent to docker:

  1. Add proxy for docker pull (dockerd)
  2. Add proxy for Docker build
  3. Add proxy to docker container

Reference articles are as follows:

Among them, if you do not want to write the running command in plain text in the startup script when using the proxy address, you can store the user name and password in environment variables, and pass these two parameters in during execution docker run.

Add agent to docker build

docker build . -f Dockerfile.frontendapi
-t registry.cn-shanghai.aliyuncs.com/jinq0123/openmatch-frontendapi:dev
–network host
–build-arg HTTP_PROXY=http://127.0.0.1:1080
–build-arg HTTPS_PROXY=http://127.0.0.1:1080

Reminder, you need to use --build-argproxy injection, simple ENVmay not be useful.

Guess you like

Origin blog.csdn.net/duoyasong5907/article/details/132145853