In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "the method of docker exiting the container without interrupting the operation of the container". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Docker enters the running container, and exit does not interrupt the operation of the container. When you enter the container and use the [ctrl+d] or exit command to exit the container, use docker ps to check and find that the container has exited. How to avoid this situation? I. Environmental description
Docker:17.09.1-ce
Docker Image: CentOS 7
Second, the problem reappears 1. Create and run container ➜docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEcentos 7 ff426288ea90 2 days ago 207MB# run container➜ docker run-dit-- name 'test-c7 -exit' centos:7a053d7016ed133c969f26ac6c31013e351d3c646ba1ea94b0b906562deb97116 ➜docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa053d7016ed1 centos:7 "/ bin/bash" 5 seconds ago Up 2 seconds2. After entering the container to complete the relevant operations After exiting, you find that the container stops # enter the container ➜docker attach test-c7-exit [root@a053d7016ed1 /] # pwd/# press [ctrl+d] or exit to exit the container [root@a053d7016ed1 /] # exit# when you see that the container also stops running➜ docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa053d7016ed1 Centos:7 "/ bin/bash" About a minute ago Exited (0) 9 seconds ago test-c7-exit 3. When reason analysis exits Use [ctrl + D], which ends the current thread of docker and the container You can use the [ctrl + P] [ctrl + Q] key combination to exit without terminating the container. Resolution process # restart the container ➜docker start test-c7-exittest-c7-exit# to view the current status of the container➜ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa053d7016ed1 centos:7 "/ bin/bash" About a minute ago Up 5 seconds Test-c7-exit# re-enter the container ➜docker attach test-c7-exit# now use [ctrl + P] [ctrl + Q] to exit [root@a053d7016ed1 /] # read escape sequence# to check the container status again Found to be still running! So much for the introduction of ➜docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa053d7016ed1 centos:7 "/ bin/bash" About a minute ago Up 26 seconds test-c7-exit "docker method to exit the container without interrupting the container". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.