Docker debugging a container that stops immediately

From EN Ikoula wiki
Revision as of 17:27, 29 July 2021 by Ikbot (talk | contribs)
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

ro:Docker depanarea unui container care se oprește imediat ru:Docker отлаживает контейнер, который немедленно останавливается pl:Docker debuguje kontener, który natychmiast się zatrzymuje ja:すぐに停止するコンテナをDockerでデバッグする zh:Docker调试一个立即停止的容器 de:Docker-Debugging eines Containers, der sofort anhält nl:Docker debuggen van een container die onmiddellijk stopt it:Docker esegue il debug di un contenitore che si ferma immediatamente pt:Depuração de um contentor que pára imediatamente es:Docker depurando un contenedor que se detiene inmediatamente fr:Docker déboguer un conteneur qui se stop immédiatement
This article has been created by an automatic translation software. You can view the article source here.

Introduction

When you start your docker run the container stops immediately, it is possible that your PID 1 did not start, however you do not see anything in the logs and cannot check in your container.
We will see how to debug a Docker container that stops immediately, by forcing a command on it at PID 1.


Course

Restart your docker run with the command below:

$ docker run -d --name NOM_DE_VOTRE_CONTENEUR NOM_DE_VOTRE_IMAGE /bin/sh -c "while true; do sleep 2; df -h; done"

This will make your PID 1 will still be running, so you can check in your container if your services are running and debug them.




Cet article vous a semblé utile ?

0



You are not allowed to post comments.