Docker proxy Configurations
Most people often find it difficult to set up docker and configure it when running behind any proxy server, if you’re trying to run Docker without having direct access to the web you have to configure the docker daemon to use a proxy server. Without it, you won’t be able to pull or push any image.
The image above is for windows docker proxy settings and you will have the same settings with the Linux servers as well, with the steps mentioned below.
I see a lot of tutorials on the internet describing how to apply the proxy in the docker configuration. but to understand what proxy settings you need according to your requirement is really important as well.
The difference between the proxy settings used by the docker daemon is described below.
USECASE 1: /etc/systemd/system/docker.service.d/http-proxy-conf
#this proxy settings are required when you want to pull or push docker images from the internet.USECASE 2: ~/.docker/config.json file or /etc/docker/daemon.json
# this proxy setting is required when you want to enable internet in your running containers. i.e all the containers running in your server will be having these proxy settings in them and you will be access internet in your containers without any problem.