moby: Ubuntu 16.04 http_proxy not work
Output of docker version
:
Docker version 1.11.1, build 5604cbe
Output of docker info
:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 1
Server Version: 1.11.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 6
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null host
Kernel Version: 4.4.0-22-generic
Operating System: Ubuntu 16.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.734 GiB
Name: rooot
ID: 2EOA:RQJS:MIO3:BJA2:UFFW:QMRR:DOSS:6IVG:CAEB:N47O:2VVE:7XFH
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Additional environment details (AWS, VirtualBox, physical, etc.):
Steps to reproduce the issue:
vim /etc/default/docker
enable http_proxydocker pull ubuntu
Describe the results you received: I’m using the http_proxy powered by squid3 publish this issue, but pull image not using proxy.
Describe the results you expected: http_proxy not work
Additional information you deem important (e.g. issue happens only occasionally): socks proxy better the http proxy
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (9 by maintainers)
Commits related to this issue
- Update install_docker.sh Fix proxy issues with Ubuntu Xenial (16.04) and systemd Based on: https://docs.docker.com/engine/admin/systemd/#runtime-directory-and-storage-driver https://github.com/doc... — committed to dlux/InstallScripts by dlux 7 years ago
- Update systemd.md (#2729) restart docker before showing the Environment variable. https://github.com/docker/docker/issues/22568#issuecomment-281092636 — committed to docker/docs by deleted user 7 years ago
The
/etc/default/docker
file is only used on systems using sysvinit and upstart (see this comment at the top of the file). Ubuntu 16.04 uses systemd, so doesn’t use that file.You can use a
daemon.json
Configuration file, as described here; https://docs.docker.com/engine/reference/commandline/daemon/#daemon-configuration-fileOr a systemd drop-in file, following the instructions here; https://docs.docker.com/engine/admin/systemd/#http-proxy
Just came across the same issue. However, I discovered that
/etc/default/docker
still works under Ubuntu 16.04 - even when using systemd. The systemd unit file under/lib/systemd/system/docker.service
actually configures/etc/default/docker
asEnvironmentFile
, meaning it gets environment variables from this file.Put your proxy settings into the file, but leave out the
export
, e.g.Restart the Docker service
systemctl docker
and you should be fine.Hello,
I’ve encountered the same proxy issue on a freshly installed ubuntu xenial this weekend but I could only make it work the following way:
I’ve followed the official doc at https://docs.docker.com/engine/admin/systemd/#http-proxy but I was out of luck. Adding this:
to /etc/systemd/system/docker.service.d/http-proxy.conf and reloading systemd just didn’t work.
I kept getting:
So I went to /lib/systemd/system/docker.service and added:
to the [Service] block. I’ve added my proxy config to /etc/default/docker (without EnvironmentFile, config wouldn’t be picked up) without exporting it
I restarted docker and now I get the proper config:
I hope it helps someone as this kept me busy for a few hours.