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

Basic operation of Docker

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Operations related to mirroring

# docker search centos # search for images

# docker image ls

# docker images

# docker image rm name/id # Delete an image

View the space occupied by images, containers, and data volumes # docker system df

Docker history nginx # View Image Modification History

Operation of containers

Docker container ls

Docker ps # shows only the containers that are running

Docker container ls-a

Docker ps-a # shows all containers

Docker run-it-- name=mynginx nginx / bin/bash # goes directly to the container. After exit, the container will stop running, but will not disappear.

Docker ps-a | grep mynginx

Docker container rm mynginx # Delete containers that are not running

Docker run-d-name=mynginx nginx # container runs in the background and can be accessed through exec. Whether the container will run for a long time is related to the command specified by docker run and has nothing to do with the-d parameter.

Docker exec-it mynginx / bin/bash # enters the container running in the background. After exit, the container will not exit.

Docker ps | grep mynginx

Docker container rm-f mynginx # forcefully deletes a running container

Docker container start id/name

Docker container restart id/name

Docker container stop id/name

Docker container logs id # View container output

Docker run-- name webserver-d-p 80:80 nginx # the first 80 is the external port, and the second 80 is the container port

Docker diff webserver # View container modifications

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