After docker run it, the mirror image quits itself. How can it not quit?

  docker, question

For example,

sudo docker run -it resin/rpi-raspbian /bin/bash

Theoretically, bash has not been shut down and should be usable, but why, look after each run

sudo docker ps

There are no running mirrors.

sudo docker run -it resin/rpi-raspbian /bin/echo "hello world"
 sudo docker ps -a

It can be verified that docker was executed and then exited. With the addition of -it command, it should enter the mirrored bash and then interact with it, but it did not. How did this happen? …

Docker version 1.12.6, build 78d1802

Your question 1

1. dockerrun-please don’t use it after it.CTRL+Cretreat from
2. UseCTRL+P+QExit the current container and reply, and he will run backstage.

If your problem is not solved, please try to view the log information.

$docker logs ${container_id}

The question behind you

Docker will default the pid inside the container to 1 as a mark. If 1 dies, the container will die. After echo “hello “,pid will die, and then the natural container will die.


In the official document, the use of run in the introduction of docker cli is included -it is as follows