1 Start the Docker service First you need to know how to start the docker service: service docker start or: systemctl start docker 2. Shut down the docker service To shut down the docker service: service docker stop or: systemctl stop docker 3 Start a container of a docker image The Docker image is called an image, and the container is called a container. For Docker, an image is static, similar to an operating system snapshot, while a container is dynamic and is a running instance of an image. For example, there is an image named ubuntu. Now let's start the container of this image and enter the bash command line of this container: docker run -t -i ubuntu /bin/bash The official website says:
It's simple to understand:
This will take you inside the container: root@af8bae53bdd3:/# If you have a running container, you can run it in the external operating system where the container is located: docker ps Check out this container. If you want to see all containers, including running ones and non-running or dormant images, run: docker ps -a If you want to exit: or: root@af8bae53bdd3:/# exit If you want to open this container again, run: docker start goofy_almeida Where "goofy_almeida" is the name of the container. 4 Entering the container 4.1 Use the "docker attach" command to enter At this time, the container is running in the background. If you want to enter its terminal, then: docker attach goofy_almeida That's it. 4.2 Use the "docker exec -it" command to enter There is a disadvantage of using the "docker attach" command to enter the container, that is, every time you exit from the container to the foreground, the container also exits. To exit the container while leaving it running in the background, use the "docker exec -it" command. Each time you use this command to enter the container, after you exit the container, the container will still run in the background. The command usage is as follows: docker exec -it goofy_almeida /bin/bash
When you exit the container by typing "exit" or pressing "Ctrl + C", the container will still run in the background, through: docker ps You can find it. 5. Exit the container Type: Or press: This is the end of this article on how to enter and exit the docker container. For more information about entering and exiting the docker container, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: JavaScript implementation of carousel example
Table of contents Import on demand: Global Import...
Superset is a lightweight self-service BI framewo...
I recently joined a new company and found some mi...
In the case of concurrent access, non-repeatable ...
Table of contents Avoid using the spread operator...
1. MySQL User Management [Example 1.1] Log in to ...
First delete mysql: sudo apt-get remove mysql-* T...
Web design, according to personal preferences and ...
Achieve results First use HTML to build a basic f...
This article shares with you how to install Kylin...
To put it simply, website construction is about &q...
Phenomenon: After MySQL version 5.7, the default ...
1. Nginx status monitoring Nginx provides a built...
Effect: First create five vue interfaces 1.home.v...
This article shares the specific code of using ca...