Docker is an application in the Ubuntu operating system for containerizing programs. For each container, you can configure Internet access through a proxy server. How to set Docker proxy will be described in this article.
Step-by-step proxy settings in Docker
For the service to work, you need to create a configuration file - by default, it is not in the system, it can be created manually. The file contains proxy settings for Docker - the hostname and port number used. Follow the detailed instructions:
Download and install the Docker package.
Create the docker.service.d folder in the etc / systemd / system directory in which the configuration file will be stored (if necessary, you can do it without the folder at all by simply specifying the path to the configuration file in etc / systemd / system).
Create a file in which the proxy server settings will be written - give it any name, for example, proxyserver.conf.
Register proxies in Docker for HTTP and HTTPS protocols.
The contents of the configuration file:
Environment = HTTP_PROXY = http: // proxyIP: port
Environment = HTTPS_PROXY = https: // proxyIP: port
Environment = NO_PROXY = localhost, 127.0.0.1, ::
Instead of proxyIP, specify the proxy IP address for Docker, specify the port as well. Next, you need to restart the daemon and restart the Docker package - this is necessary to apply the parameters entered in the configuration file. It remains to verify the functionality of the proxy. To get the smallest response time, we recommend using individual proxies. As for the free HTTP proxies for Docker, delays, and crashes are possible when using them - they are often overloaded.