Phenomenon Start the Docker container docker run –name [CONTAINER_NAME] [CONTAINER_ID] Check the running status of the container docker ps -a It is found that the mydocker container just started has exited reason It is very important to point out that for a Docker container to run in the background, there must be a foreground process. If the command run by the container is not a command that has been suspended (such as running top or tail), it will automatically exit. The main thread of the docker container (the command executed by CMD in the dockerfile) ends and the container exits Workaround You can use interactive startup docker run -i [CONTAINER_NAME or CONTAINER_ID] The above is not very friendly, it is recommended to use background mode and tty options docker run -dit [CONTAINER_NAME or CONTAINER_ID] View container status docker ps -a Docker calls out the background container docker attach [CONTAINER_NAME or CONTAINER_ID] Tips: When exiting, use [ctrl + D], which will end the current Docker thread and the container. You can use [ctrl + P] [ctrl + Q] to exit without terminating the container. The following command will execute the specified command in the specified container. [ctrl+D] will not terminate the container after exiting. docker exec -it [CONTAINER_NAME or CONTAINER_ID] /bin/bash The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: A brief talk about React Router's history
Generally speaking, the mouse is displayed as an u...
1. Reason I just needed to reinstall MySQL on a n...
In the process of using Vue to develop projects, ...
Through the brief introduction in the previous tw...
Table of contents Step 1: Installation Step 2: Ci...
This article shares the specific code of JS to ac...
1. Enter the configuration file of the yum source...
A must-have for interviews, you will definitely u...
I'll record the problems I encountered during...
Copy code The code is as follows: html { overflow...
This article example shares the specific code of ...
Table of contents Proxy forwarding rules The firs...
Preface Hello everyone, this is the CSS wizard - ...
The development history of CSS will not be introd...
Add table fields alter table table1 add transacto...