I created some containers and they are not ready to use, always "restarting" status:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02141a219070 debian "/bin/bash" 53 minutes ago Restarting (0) 3 minutes ago test
3a8b684011d4 debian "/bin/bash" About an hour ago Restarting (0) 4 minutes ago 10.140.10.151:443->443/tcp support-web.equifax.ru
ad40188569cd debian "/bin/bash" 4 hours ago Restarting (0) 25 minutes ago 10.140.10.150:443->443/tcp vpn.equifax.ru
No exec:
docker exec test /bin/bash
Error response from daemon: Container test is restarting, wait until the container is running
No logs:
docker logs test
I have created the container this way:
docker run --name=test --restart=always debian /bin/bash
How to troubleshoot Docker?
You can use the --restart=unless-stopped option, as @Shibashis mentioned, or update the restart policy (this requires docker 1.11 or newer); See the documentation for docker update and Docker restart policies. Use docker update --restart=no $(docker ps -a -q) to update all your containers :-) Great answer!!
Docker also lets the user set the restart policy upon exit or failure. Users can type docker ps to check if the restart policy is active; it will be shown as either Up , when the container is up and running, or Restarting when the container is in the restart state.
The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status , or checking the service status using Windows utilities.
Quit DockerOpen Activity Monitor via Launchpad or Spotlight. Highlight all Docker processes, click the Stop button in the toolbar, and click Quit or Force Quit.
You need run it interactively.
docker run -ti --name=test --restart=always debian /bin/bash
-t, --tty=false Allocate a pseudo-TTY
-i, --interactive=false Keep STDIN open even if not attached
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With