dockerboot2docker

How to check if the restart policy works of Docker


From the Docker document, there is a restart policy parameter could be set.

How do I verify the container indeed restarts when the container exits. How to trigger the exit of container manually, and observe if the container restarts?

My environment is Mac and boot2docker.

Thanks


Solution

  • you can also docker exec -it container_id bash and then kill -9 of the main process. I tested with docker run -d --restart=always -e DISPLAY=$DISPLAY -v /home/gg/moncontainer:/home/gg -v /tmp/.X11-unix:/tmp/.X11-unix k3ck3c/captvty I killed the main process (pid 5, Captvty.exe), was logged out of the container, and 2 seconds later it was restarted, the window was created again