Summary of docker FAQs (continuously updated)

  1. The error reported by Docker pull is as follows:
-bash-4.2# docker pull hub.yj.com/test/dep_client:test
Error response from daemon: Get http://hub.yj.com/v2/: dial tcp: lookup hub.yj.com on 218.2.135.1:53: server misbehaving

As shown below:

image-20200909145556639

Reason analysis:

The domain name (hub.yj.com) cannot be resolved locally, and the DNS corresponding to the domain name needs to be configured

solution:

vi /etc/resolv.conf

before fixing:

# Generated by NetworkManager
nameserver 218.2.135.1

After modification:

# Generated by NetworkManager
nameserver 172.16.6.107  # 此行为增加部分,该IP为hub.yj.com域名对应的DNS地址
nameserver 218.2.135.1

Docker pull again can be successful

  1. The error reported by docker pull is as follows:
[root@yunjia-03-centos7-135-in ~]# docker pull hub.yj.com/test/dep_client:test
Error response from daemon: Get https://hub.yj.com/v2/: dial tcp 172.16.6.253:443: getsockopt: connection refused

or

[root@yunjia-03-centos7-135-in ~]# docker pull hub.yj.com/test/dep_client:test
Error response from daemon: Get https://hub.yj.com/v2/: dial tcp: lookup hub.yj.com on 218.2.135.1:53: read udp 172.16.6.104:57822->218.2.135.1:53: i/o timeout

Reason analysis:

The main reason is that the warehouse address is not configured in the docker configuration file, just add the warehouse address

solution:

vi /etc/docker/daemon.json

before fixing:

{
    
    
  "registry-mirrors": ["https://zanh3wut.mirror.aliyuncs.com"],
  "insecure-registries": ["172.16.6.108:8089"]   
}

After modification:

{
    
    
  "registry-mirrors": ["https://zanh3wut.mirror.aliyuncs.com"],
  "insecure-registries": ["172.16.6.108:8089","hub.yj.com"]   # 增加该仓库信息hub.yj.com
}

Restart the docker service

-bash-4.2# systemctl restart docker

Then go to docker pull to successfully pull.

  1. The IP address of a certain service cannot be pinged inside docker

Phenomenon:

Entering docker, telnet or pinging a certain service or IP address is not available, but it is available after exiting docker.

Reason: The server needs to do internal forwarding.

solution:

Edit /etc/sysctl.confthe file of the server (the server outside the docker), and add the following content at the end of the file:

#开启网桥模式
net.bridge.bridge-nf-call-ip6tables=1
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-arptables=1
#开启转发
net.ipv4.ip_forward=1

Execute the command to make it effective:

[root@VCS01 ~]# sysctl -p
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
net.ipv4.ip_forward = 1
[root@VCS01 ~]#

You can see that the newly added content will take effect.

Then enter the docker verification to pass normally.

  1. After the docker swarm deploys the service, it cannot start the problem

    Phenomenon:

    After the service is deployed, the service cannot be started, and there is no log when viewing the log through docker logs. The status of the container is as follows:

    image-20221118181058131

    Troubleshooting method:

    You can see the startup log of the container through docker service ps --no-trunc {serviceName}the command, as follows:

    image-20221118181455520

    It can be seen that the mirror address or name is wrong, and we can quickly locate the cause of the problem at this time

Guess you like

Origin blog.csdn.net/tl4832194/article/details/127927632