Phenomenon:Run an image, for example, ubuntu14.04: docker run -it --rm ubuntu:14.04 bash On exit:Execute Ctrl+D or execute exit View the thread: docker ps It is empty, indicating that there is no running container. Solution:Run an image: docker run -dit ubuntu:14.04 View the thread: Found a thread and opened it: docker attach 【CONTAINER ID or NAMES】 If you want to continue running when exiting: press [ctrl+p], [ctrl+q] in sequence If you do not want to continue running: press [ctrl+d] or enter exit In addition: To restart after shutdown, please enter: docker restart [CONTAINER ID or NAMES] Supplement: Docker - Avoid running a shell script after starting the container and then exiting the container after the execution is completed Recently, I was using Dockerfile to start a container and found that when I used Dockerfile to call the shell in the container, Docker would exit the container after the shell was executed. analyzeWhen Docker executes the shell, it executes it in the background; therefore, after the shell is executed, Docker detects that there is no foreground task to be executed and exits the container. WorkaroundAdd a "never complete" command to the end of the shell script: # tail -f /dev/null In this way, when this command is executed, the shell will not exit, and the container will not exit either. The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: A collection of button hover border and background animations based on CSS properties
>>: How to redirect PC address to mobile address in Vue
This article shares the specific code of Vue usin...
as follows: -m, --memory Memory limit, the format...
Table of contents 1. Brief Overview 2. Detailed e...
This article example shares the specific code of ...
Use scenarios: The project's pages need to lo...
The default ssh remote port in Linux is 22. Somet...
Write at the beginning This article only covers E...
This error is often encountered by novices. This ...
This article mainly introduces how to add floatin...
Study plans are easily interrupted and difficult ...
Let’s not start with the introduction and get str...
transform and translate Transform refers to trans...
The environment of this article is Windows 10, an...
Preface When introducing defineProperty before, I...
WeChat applet form validation, for your reference...