I have started learning about containerisation with the view ultimately of deploying it in a production environment for some of the services at my larger clients. Testing and developing this however is made more difficult by the use of a mandated proxy by those who control the WAN and access to the greater internet.
Consequently when I was attempting to pull images and files from the Docker Hub I was getting errors.
Now I could use environment variables, but as this is a test machine and is on my laptop it is not always going to be behind a proxy (it is most of the time, just not always).
Consequently I wanted to add or enable the proxy variable in the Docker configuration file. Fortunately it is easy to find both the file and the line to edit.
For my test machine which is running Ubuntu Server 14.04 it is in the following location
So you want to edit it (remembering to use sudo) with the following command
sudo nano /etc/default/docker
in this file there is a commented out line beginning with
#export http_proxy “http://127.0.0.1:3128/“
Simply remove the # from the start of the line, and fill in the section that contains http://127.0.0.1:3128/ with your proxy details (http://serveraddress:portnumber/)
Save the file
[Ctrl+o] Alternatively you can save the file upon exit, the system will prompt you
If it refuses to save to the location, it is most likely due to lack of permissions, you did sudo when you opened nano didn’t you?
Now restart the docker process
sudo service docker.io restart (again notice the sudo)
Now you can pull down images if you got your setting right