Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The first acquaintance of container in docker Learning

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

image is a class, container is an instantiated class object

The fastest way to create a container based on an image is

docker run skinglzw/hello-world Running a docker is a container

cd /root/hello-world

View containers currently running locally

docker container ls

docker container ls -a Lists all containers, including running ones

more Dockerfile

docker run centos:7

Method for interactively running containers

docker run -it centos

Exit docker

exit

docker image Enter

docker container Enter

delete a container

docker container rm 3b507da48bdc equals docker rm 3b507da48bdc

docker container ls -a equals docker ps -a

Delete image

docker image rm fce289e99eb9 equals docker rmi fce289e99eb9

docker run skinglzw/hello-world executes 5 times to create container

docker ps -a

docker container ls -aq enumerates all containerId similar to docker container ls -a| awk {'print$1'}

docker rm $(docker container ls -aq) Delete all containers

docker

There are 5 identical image containers deleted in batches

docker container ls -f "status=exited" List the status is exited

docker container ls -f "status=exited" -q List containerId only

docker rm $(docker container ls -f "status=exited" -q)

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report