Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to check for errors if the docker container doesn't work

Shulou Source: shulou.com Published: 2022-06-01 02:54:12 09月23日 Update

Editor to share with you how to check the error of the docker container, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Log in to the docker host to analyze the problem

1. Start the iframe-test machine

Root@ubuntu:~#docker start iframe-testiframe-test

2. No container process is found

Root@ubuntu:~#docker ps | grep iframe-test

3. Check the log and find that there is a problem with the nginx configuration, which leads to the interruption.

Root@ubuntu:~# docker logs iframe-testStartingnginx: Starting periodic command scheduler: cron.nginx: [emerg] unexpected end of file, expecting ";" or "}" in/etc/nginx/nginx.conf:21nginx:configuration file / etc/nginx/nginx.conf test failed

Second, the fault prompt of docker container startup.

[root@server opt] # docker run-it-rm-name aa centos:latest/usr/bin/docker-current: Error response from daemon: shim error: docker-runc not installed on system.

Solution method

[root@server opt] # cd / usr/libexec/docker/ [root@server docker] # sudo ln-s docker-runc-current docker-runc

3. Docker container does not have enough memory.

Docker needs at least 2 gigabytes of memory to start. First, execute the free-mh command to see if the remaining memory is sufficient.

View memory directly

$free-mhtotal used free shared buff/cache availableMem: 15G 14G 627M 195M 636m 726MSwap: 0B 0B 0B

Analysis log

Sometimes memory overload overflows in an instant, causing some processes to be killed, and it seems that there is enough memory. In fact, docker will restart repeatedly, which needs to be further analyzed through docker logs and system log messages.

In addition, there must be a foreground process for the Docker container to run in the background. The commands run by the container will exit automatically if they are not those that have been suspended (such as running top,ping).

The above is all the contents of the article "how to check errors if the docker container can't get up". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Container memory log command article process analysis run error content problem not enough not much fact in fact foreground background enough mostly host Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Apple Huawei Linux