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
In MySQL, fields of char, varchar, and text types...
Table of contents forEach() Method How to jump ou...
Table of contents 1. Event Flow 1. Concept 2. DOM...
1. What are custom hooks Logic reuse Simply put, ...
introduce This article is based on React + antd t...
1. Inline elements only occupy the width of the co...
Hyperlinks are the most frequently used HTML elem...
MySQL 8.0.22 download, installation and configura...
Table of contents Preface Child components pass d...
Table of contents 1. Get the first link first 2. ...
1. Delete node Execute kubectl delete node node01...
Table of contents SSH protocol SSH Connection pro...
It is essentially a common js object used to desc...
Detailed explanation and summary of the URL for d...
Table of contents background question Problem ana...