Remember a docker error and solution record

Scenario:
systemctl stop docker

swap off:
swapoff -a
swapon -a

systemctl start docker

docker-compose -f docker.yml up
appears:

ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 100).

As shown in the following results:
starting and stopping the service will cause a timeout and stuck situation .
1.PNG
The first time
systemctl stop docker is successful,
after that,
all operations, such as:
systemctl start docker
service start docker
will be stuck and do not move
;

Solution steps:

  1. systemctl status docker View docker status:

2.PNG

It's always been like this,

  1. According to the Internet, to start docker, you need to start monitoring first: dockerd

Then enter this command:
3.PNG
It’s strange that when the port is occupied, ps -ef and netstat-lnp can’t find it.
Finally, I found this big guy to the article, which teaches how to solve the problem of docker port occupation: https://blog. csdn.net/jabony/article/details/92759417

  1. Turn off keepalived to let the virtual IP drift to an available host

systemctl stop keepalived

  1. Find the corresponding container and close

netstat-lnp
8.PNG
kill -9 64604

  1. After the above operations, there are still some that cannot be found, but the container id can be found, as shown in blue in the figure: it says that the port is allocated by the container4.PNG

Then, just delete all these containers,
cd /var/lib/docker/containers
rm -rf container id
again dockerd did not report an error,

Execution: systemctl status docker
5.PNG
status has changed, it is a bit of a change
,

The magic is that docker ps, docker logs, docker images, docker-compose up/down can all be used!

Don’t panic, we just ran dockerd, it’s not over yet, after ctrl+c:
6.PNGsystemctl start docker
systemctl status docker Let’s take a look again, it’s normal
7.PNG

  1. Configuration restore:

systemctl start keepalived

What a big deal!

Guess you like

Origin blog.csdn.net/qq_28911061/article/details/120471262