The Problem
When trying to search docker images under docker repository, returns with error below :
# docker search centos Error response from daemon: Get https://index.docker.io/v1/search?q=oracle%2A: dial tcp 52.72.231.247:443: getsockopt: no route to host
The docker is engine is running fine.
# systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Sat 2017-11-18 06:37:54 UTC; 4min 54s ago Docs: https://docs.docker.com Main PID: 1109 (dockerd) Memory: 72.6M CGroup: /system.slice/docker.service ├─1109 /usr/bin/dockerd └─1127 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/...
Also, SELinux is set to Permissive mode and iptables are allowed to have Docker traffic.
# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy DROP) target prot opt source destination DOCKER-USER all -- anywhere anywhere DOCKER-ISOLATION all -- anywhere anywhere ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED DOCKER all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain DOCKER (1 references) target prot opt source destination Chain DOCKER-ISOLATION (1 references) target prot opt source destination RETURN all -- anywhere anywhere Chain DOCKER-USER (1 references) target prot opt source destination RETURN all -- anywhere anywhere
# sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: permissive Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 28
Enabling proxy for Docker
For the Docker node to communicate with Docker hub, you need to have proxy enabled. This is required when you have an environment under the firewall. There are 2 ways in which this can be done.
Method 1
1. To configure web proxy networking options, create the drop-in file /etc/systemd/system/docker.service.d/http-proxy.conf that contains the following lines:
# vi /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=proxy_URL:port" Environment="HTTPS_PROXY=proxy_URL:port"
2. Replace proxy_URL and port with the appropriate URLs and port numbers for your web proxy.
Method 2
1. Open the file /etc/sysconfig/docker using any editor and append the below two entries.
# vi /etc/sysconfig/docker HTTP_PROXY="http://[proxy_IP].domain.com:80" HTTPS_PROXY="http://http://[proxy_IP].domain.com:80"
2. Once completed start/stop the docker service
# systemctl stop docker # systemctl start docker