Bug 1084232 - Docker fails to pull images from behind a proxy server
Summary: Docker fails to pull images from behind a proxy server
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: docker-io
Version: 20
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Lokesh Mandvekar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-04 00:33 UTC by Darryl Bond
Modified: 2014-07-01 23:00 UTC (History)
10 users (show)

Fixed In Version: docker-io-0.11.1-7.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-10 02:50:46 UTC


Attachments (Terms of Use)

Description Darryl Bond 2014-04-04 00:33:47 UTC
Description of problem: Docker-io does not work behind a proxy server
The docker daemon does not use the proxy and attempts to access directly


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
HTTP_PROXY=http://my_proxy:3128/ docker pull busybox

Actual results:
Pulling repository busybox
2014/04/04 08:56:42 Get https://index.docker.io/v1/repositories/busybox/images: dial tcp: lookup index.docker.io on [10.x.x.x]:53: no such host

Expected results:
Unable to find image 'busybox' locally
Pulling repository busybox
769b9341d937: Download complete 
511136ea3c5a: Download complete 
bf747efa0e2f: Download complete 
48e5f45168b9: Download complete 
hello world

Additional info:

Fixed by adding an environment file to docker.service



Add file /etc/sysconfig/docker containing 
HTTP_PROXY=http://my_proxy:3128

Add
EnvironmentFile=-/etc/sysconfig/docker

to docker.service file

Comment 1 Vincent Batts 2014-04-06 02:24:06 UTC
you were right to add the HTTP_PROXY to where the docker daemon would use it. The `docker pull` does not actually fetch bits, but rather instructs the daemon to fetch the bits.

I'm not sure it is expected behavior for the docker cli to pass HTTP_PROXY to the daemon for use. This would need to be investigated. If it is the case that the cli neither uses nor passes HTTP_PROXY, then this is working as intended. Perhaps there should be verbage in the man-pages for `docker pull` and `docker run`.

Comment 2 Darryl Bond 2014-04-07 21:09:22 UTC
Most references to docker and proxies found on google do not explicitly say where the HTTP_PROXY should be set.
My suggestion is to add an EnvironmentFile to the systemd service file as part of the package. It is strange that it is missing as most similar daemons have one.

Comment 3 Marcello de Sales 2014-04-11 07:21:42 UTC
I have the same problem and I still can't find a solution:

[mdesales@pppdc9prd1vq ~]$ HTTP_PROXY=http://proxy02.xyz.net:80 docker pull ubuntu
Pulling repository ubuntu
2014/04/11 00:16:45 pull: Get https://index.docker.io/v1/repositories/ubuntu/images: dial tcp 54.224.119.89:443: connection timed out

My environment is set with the given proxy and I can download the same URL with WGET...

[mdesales@pppdc9prd1vq ~]$ wget https://index.docker.io/v1/repositories/ubuntu/images
--2014-04-11 00:01:39-- https://index.docker.io/v1/repositories/ubuntu/images
Resolving qypprdproxy02.ie.intuit.net... 10.158.64.16
Connecting to qypprdproxy02.ie.intuit.net|10.158.64.16|:80... connected.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: `images'

[ <=> ] 6,489 --.-K/s in 0.002s

2014-04-11 00:01:39 (2.80 MB/s) - `images' saved [6489]

Comment 4 Marcello de Sales 2014-04-11 07:47:38 UTC
Got it working!

[mdesales@pppdc9prd1vq ~]$ sudo HTTP_PROXY=http://proxy02.ie.xyz.net:80 ./docker -d &
[2] 20880
[mdesales@pppdc9prd1vq ~]$ 2014/04/11 00:45:25 WARNING: You are running linux kernel version 2.6.32-431.1.2.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0.
[/var/lib/docker|aa088847] +job serveapi(unix:///var/run/docker.sock)
[/var/lib/docker|aa088847] +job initserver()
[/var/lib/docker|aa088847.initserver()] Creating server
2014/04/11 00:45:25 Listening for HTTP on unix (/var/run/docker.sock)
[/var/lib/docker|aa088847] +job init_networkdriver()
[/var/lib/docker|aa088847] -job init_networkdriver() = OK (0)
Loading containers: : done.
[/var/lib/docker|aa088847.initserver()] Creating pidfile
[/var/lib/docker|aa088847.initserver()] Setting up signal traps
[/var/lib/docker|aa088847] -job initserver() = OK (0)
[/var/lib/docker|aa088847] +job acceptconnections()
[/var/lib/docker|aa088847] -job acceptconnections() = OK (0)

mdesales@pppdc9prd1vq ~]$ sudo docker pull base
2014/04/11 00:46:02 POST /v1.10/images/create?fromImage=base&tag=
[/var/lib/docker|aa088847] +job pull(base, )
Pulling repository base
b750fe79269d: Download complete
27cf78414709: Download complete
[/var/lib/docker|aa088847] -job pull(base, ) = OK (0)

Comment 5 Daniel Walsh 2014-05-28 16:48:55 UTC
THis working now?  Can I close this bug?

Comment 6 Darryl Bond 2014-05-28 21:14:04 UTC
It will be still broken unless the environment file is added to the docker package for the daemon startup.
Note Marcello (above) is starting the docker daemon manually rather than by systemd.

I fixed it for my install by doing that indicated in the first post.
I imagine the docker package maintainer has to fix it for everyone.

Comment 7 Lokesh Mandvekar 2014-05-28 21:23:49 UTC
ack, thanks, I'll add the EnvironmentFile variable (pointing to /etc/sysconfig/docker)

Comment 8 Fedora Update System 2014-05-29 12:55:40 UTC
docker-io-0.11.1-7.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-io-0.11.1-7.fc20

Comment 9 Fedora Update System 2014-05-29 13:08:39 UTC
docker-io-0.11.1-7.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-io-0.11.1-7.fc19

Comment 10 Fedora Update System 2014-05-29 23:25:22 UTC
Package docker-io-0.11.1-7.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing docker-io-0.11.1-7.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-6848/docker-io-0.11.1-7.fc19
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2014-06-10 02:50:46 UTC
docker-io-0.11.1-7.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2014-06-10 02:53:41 UTC
docker-io-0.11.1-7.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.