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