Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker status "Restating" forever

Tags:

docker

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?

like image 363
xoid Avatar asked Mar 22 '16 14:03

xoid


People also ask

How do I stop Docker container from restarting?

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!!

How can I tell if Docker is restarting?

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.

How can I check my Docker status?

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.

How do I force quit Mac Docker?

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.


1 Answers

You need run it interactively.

docker run -ti --name=test --restart=always debian /bin/bash

Explanation

   -t, --tty=false                 Allocate a pseudo-TTY
   -i, --interactive=false         Keep STDIN open even if not attached
like image 168
BMW Avatar answered Sep 28 '22 02:09

BMW