Docker - Container is not running

2020-02-16 07:28发布

I'm completely a newbie to docker. I tried to start a exited container like follows,

  1. I listed down all available containers using docker ps -a. It listed the following, docker list all images
  2. I entered the following commands to start the container which is in the exited stage and enter into the terminal of that image.

    docker start 79b3fa70b51d docker exec -it 79b3fa70b51d \bin\sh

  3. It is throwing the following error.

    FATA[0000] Error response from daemon: Container 79b3fa70b51d is not running

But when I start the container using docker start 79b3fa70b51d. It throws the container ID as output which is normal if it have everything work normally. I'm not sure what causes this error. Any idea about the causes and suggestions about this would be greatly helpful for me. Thanks in advance.

7条回答
Explosion°爆炸
2楼-- · 2020-02-16 08:03

This happens with images which are exiting immediately, because there is no command that triggers a service waiting for requests, for example.

So you may just run the image in interactive mode. Example below with the node image:

docker run -it node /bin/bash

Output is

root@cacc7897a20c:/# echo $SHELL
/bin/bash
查看更多
登录 后发表回答