In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to create, list and delete Docker containers on Linux. I hope you will learn a lot after reading this article. Let's discuss it together.
1. Start the Docker container
Start the new Docker container using the following command. This will launch a new container and give you access to the container using / bin/bash shell.
# docker run [OPTIONS] [COMMAND] [ARG...]
For example, the following command creates a new docker container using an image named "ubuntu". To list all available images, use the docker images command.
# docker run-I-t ubuntu / bin/bash
To exit the Docker container, press ctrl+p+q. This will allow the container to run in the background and provide the host system console. If you use the exit command, it stops the current container.
2. List Docker containers
Once it exists from the Docker container, execute the following command to list all the running containers.
# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESf2582758af13 ubuntu "/ bin/bash" 2 hours ago Up 2 hours first_ubuntu
By default, the above command lists only the containers that are running. To list all containers, including those that have been stopped, use the following command.
# docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESf2582758af13 ubuntu "/ bin/bash" 2 hours ago Up 2 hours first_ubuntu6b5b5a969241 centos "/ bin/bash" 2 days ago Exited (0) 24 hours ago ubuntu-web
3. Start / stop / connect the container
You can start, stop, or attach to any container using the following command. To start the container, use the following command.
# docker start
To stop the container, use the following command.
# docker stop
To attach to the currently running container, use the following command.
# docker attach
4. Discard the Docker container
Before deleting any containers, make sure that the containers are stopped. You can use the 'docker ps-a' command to list the status of the container. If the container is still running, first stop the container using the command given in the steps above.
Now use the following command to delete single or multiple containers.
# docker rm
You can also delete all stopped containers at once using the following command.
# docker rm $(docker ps-a-Q) after reading this article, I believe you have some understanding of how to create, list and delete Docker containers on Linux. If you want to learn more about it, please follow the industry information channel. Thank you for reading!
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.