proxydocker

Docker container, how to use host proxy


Because I'm in China it is nearly impossible to use Docker Hub, Git, GitHub, npm and loads of other tools without a VPN.

I finally found how to have the Docker daemon use a proxy (share VPN in the VPN client software on the host is the proxy server).

But as soon as I run the container I'm behind the firewall again and the container is not using the host proxy. This would make it impossible to get anything from GitHub, use npm, Bower and lots of other things.

How can I force the container to use the host proxy?


Solution

  • I fixed it by setting the proxy in /etc/default/docker.

    I also had to unset the proxy in the environment variables:

    unset http_proxy
    unset https_proxy