The image exits by itself after docker run it. How to prevent it from exiting?
怪我咯
怪我咯 2017-05-24 11:32:56
0
2
1016

As the title says,

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

Theoretically speaking, bash has not been closed and should be usable, but why, check after each run

sudo docker ps 

There are no running images.
pass

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

//或者

sudo docker ps -a

It can be verified that docker has been executed and then exited. Adding the -it command should enter the bash of the image and then interact, but it does not. How to deal with this situation...

Docker version 1.12.6, build 78d1802

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
phpcn_u1582

Your question 1

1. Docker run -it Please do not use CTRL+C退出
2.使用CTRL+P+Q to exit the internal session of the current container, it will run in the background.

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

$docker logs ${container_id}

Your next question

Docker will default the internal pid of the container to 1 as the identifier. If 1 dies, the container will die. After echo "hello", the pid will die, and then the natural container will die.

Documentation

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

我想大声告诉你

Because you didn’t add the -d parameter

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template