A proxy is required when the server running Docker does not have direct access to the Internet. Configure the Docker daemon to use a proxy server to access images stored on the official Docker Hub Registry or 3rd-party registries. There are 2 ways to configure the proxy for docker :
Configuring proxy variables in the /etc/sysconfig/docker file
Configuring environment variables
Method 1 : Configuring proxy variables in the /etc/sysconfig/docker file
Method 2 : Configuring environment variables
Method 3 : Configuring environment variables
On the Docker client, create or edit the file ~/.docker/config.json
in the home directory of the user which starts containers. Add JSON such as the following, substituting the type of proxy with httpsProxy
or ftpProxy
if necessary, and substituting the address and port of the proxy server. You can configure multiple proxy servers at the same time.
You can optionally exclude hosts or ranges from going through the proxy server by setting a noProxy
key to one or more comma-separated IP addresses or hosts. Using the *
character as a wildcard is supported, as shown in this example.
- Implementing Managed IT Services: A Step-by-Step Guide - August 30, 2024
- DevOps Foundation Certification - August 29, 2024
- SRE Foundation Certification - August 29, 2024