Looking at docs there is no instruction on how to run it behind a proxy. https://docs.docker.com/installation/ubuntulinux/
Reading on forums, the instruction is to update /etc/default/docker to export the proxy setup.
export http_proxy="http://127.0.0.1:3128/"
export https_proxy="http://127.0.0.1:3128/"
export HTTP_PROXY="http://127.0.0.1:3128/"
export HTTPS_PROXY="http://127.0.0.1:3128/"
Then we restart/start docker
sudo service docker start
Inside a container, if I run 'apt-get', npm install, bower install I cant get through the proxy.
Not sure what I m missing.
You should replace
127.0.0.1
to your host IP or some public accessible IPFor Ubuntu 14.04.2 LTS
Linux vagrant-ubuntu-trusty-64 3.13.0-54-generic #91-Ubuntu SMP Tue May 26 19:15:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Edit you
/etc/default/docker
fileAdd this line at the bottom:
Restart the
docker
servicesystemctl will have to installed, which can be problematic. In case /etc/systemd/system/docker.service.d/http-proxy.conf or /etc/default/docker solution does not work for you, simply use the below command:
docker build [OPTIONS] PATH --build-arg http_proxy=http://your.proxy:port --build-arg https_proxy=http://your.proxy:port --build-arg no_proxy=.internal.domain,localhost,127.0.0.1
According to the Docs
Add to
~/.docker/config.json
proxy configurationYou can try to add lines in
/etc/environment
:it will be useful for all services on your Linux system
Then edit
/lib/systemd/system/docker.service
. In the end of the[Service]
section, add line:And then:
Ubuntu 14.04 LTS
For
Ubuntu 14.04 LTS
who usesSysVinit
, you should modify/etc/default/docker
file:Then restart
docker
:Ubuntu 16.04 LTS / Ubuntu 18.04 LTS
For
Ubuntu 16.04 LTS
who usesSystemd
, you can follow this post:(1) Create a systemd drop-in directory:
(2) Add proxy in
/etc/systemd/system/docker.service.d/http-proxy.conf
file:(3) Flush changes:
(4) Restart Docker:
Official Reference