Phenomenon
Start the Docker container
Docker Run–name [Container_name] [container_id]
View Container Run status
Docker Ps-a
Find out Why the Mydocker container has just started
The main thread of the Docker container (the command executed by CMD in dockfile) ends and the container exits the method
You can use the interactive boot
Docker run-i [Container_name or container_id]
The above is not very friendly, we recommend using background mode and TTY options
Docker Run-dit [Container_name or container_id]
View container Status
Docker Ps-a
Docker brings up the background container
Docker attach [Container_name or container_id]
TIPs: When exiting, use [Ctrl + D], this will end the current Docker thread, the container ends, you can use [Ctrl + P][ctrl + Q] to exit without terminating the container run
The command is executed in the specified container, and [ctrl+d] does not terminate the container when it exits.
Docker exec-it [Container_name or container_id]/bin/bash