I was playing with docker little bit. After while I found out that I'm unable to interact with docker hub registry. Of course it is proxy. Again.
Error message at first:
[root@kra ~]$ docker search centos 2014/08/04 07:45:36 Error: Get https://index.docker.io/v1/search?q=centos: dial tcp 107.22.52.107:443: connection refused
It looks like proxy issue. But how to fix it? After googling for a while I found out, that I could start docker daemon with proxy environmental variables.
But docker daemon is started by systemd. So I looked into systemd configuration /usr/lib/systemd/system/docker.service
:
[root@kra ~]$ cat /usr/lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=http://docs.docker.io After=network.target [Service] Type=notify EnvironmentFile=-/etc/sysconfig/docker ExecStart=/usr/bin/docker -d --selinux-enabled Restart=on-failure LimitNOFILE=1048576 LimitNPROC=1048576 [Install] WantedBy=multi-user.target
There is definition of EnvironmentFile
pointing to /etc/sysconfig/docker. File is empty:
[root@kra ~]$ cat /etc/sysconfig/docker # /etc/sysconfig/docker
I've put proxy environment variables there:
[root@kra ~]$ cat /etc/sysconfig/docker # /etc/sysconfig/docker http_proxy='http://user:password@proxy.somewhere.net:8080/'
After restarting docker daemon I've checked environment of docker process:
[root@kra ~]$ systemctl restart docker [root@kra ~]$ ps -ef | grep docker root 1977 1523 0 17:10 pts/2 00:00:00 grep --color=auto docker root 3335 1 0 Jul30 ? 00:02:08 /usr/bin/docker -d --selinux-enabled [root@kra ~]$ cat /proc/3335/environ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binLANG=en_US.UTF-8NOTIFY_SOCKET= @/org/freedesktop/systemd1/notifyhttp_proxy=http://user:password@proxy.somewhere.net:8080/[root@kra ~]$
And finally it is working:
[root@kra ~]$ docker search centos | head -n 5 NAME DESCRIPTION STARS OFFICIAL TRUSTED centos The official build of CentOS. 286 [OK] tianon/centos CentOS 5 and 6, created using rinse instea... 24 blalor/centos Bare-bones base CentOS 6.5 image 5 [OK] tutum/centos-6.4 DEPRECATED. Use tutum/centos:6.4 instead. ... 5 [OK]
No comments:
Post a Comment