GNU/Linux >> Tutoriels Linux >  >> Panels >> Docker

Comment résoudre l'erreur de commande de recherche Docker - "getsockopt :pas de route vers l'hôte" dans CentOS / RHEL / Fedora

Le problème

Lorsque vous essayez de rechercher des images Docker dans le référentiel Docker, renvoie l'erreur ci-dessous :

# 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

Le docker est le moteur fonctionne bien.

# 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/...

De plus, SELinux est défini sur le mode Permissif et iptables est autorisé à avoir du trafic Docker.

# 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

Activation du proxy pour Docker

Pour que le nœud Docker communique avec le hub Docker, vous devez activer le proxy. Ceci est requis lorsque vous avez un environnement sous le pare-feu. Il y a 2 façons de procéder.

Méthode 1

1. Pour configurer les options de mise en réseau du proxy Web, créez le fichier d'insertion /etc/systemd/system/docker.service.d/http-proxy.conf qui contient les lignes suivantes :

# vi /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=proxy_URL:port"
Environment="HTTPS_PROXY=proxy_URL:port"

2. Remplacez proxy_URL et port par les URL et les numéros de port appropriés pour votre proxy Web.

Méthode 2

1. Ouvrez le fichier /etc/sysconfig/docker en utilisant n'importe quel éditeur et ajoutez les deux entrées ci-dessous.

# vi /etc/sysconfig/docker
HTTP_PROXY="http://[proxy_IP].domain.com:80"
HTTPS_PROXY="http://http://[proxy_IP].domain.com:80"

2. Une fois terminé, démarrez/arrêtez le service docker

# systemctl stop docker
# systemctl start docker


Docker
  1. Comment installer Google Chrome 17 sur Fedora 16, CentOS 6 / RHEL 6

  2. Comment installer Docker sur CentOS 7 / RHEL 7

  3. Comment configurer le proxy dans CentOS/RHEL/Fedora

  4. Erreur LVM « AVERTISSEMENT :Métadonnées incohérentes trouvées » - Comment résoudre dans CentOS / RHEL

  5. Comment résoudre l'erreur "-bash:xclock:command not found" dans CentOS / RHEL

Comment installer VirtualBox 5.1 sur CentOS 7 / RHEL 7 / Fedora 26

Comment installer Docker CE sur CentOS 8 / RHEL 8

26 exemples de commandes DNF dans Fedora / CentOS / RHEL

Comment installer Cockpit sur CentOS 7 / RHEL 7 et Fedora 28

Comment installer pgAdmin 4 sur CentOS 7 / RHEL 7 et Fedora 29 / Fedora 28

Comment installer Scala 3 sur RHEL 8 / CentOS 8