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

What are the common commands of docker?

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

Share

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

This article will explain in detail what commands are commonly used in docker. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Start docker

Systemctl start docker

Close docker

Systemctl stop docker

Restart docker

Systemctl restart docker

View all service containers

Docker ps-a does not add-an only view the container that is running

Stop the service container

Docker stop containerid

Delete service container

Docker rm containerid

Package image

Docker build-t mcstest:1606462949. Note: 1606462949 is tag, which can be obtained by new Date (). GetTime () in js, excluding the last three digits, or you can write the date 20201212 directly. It is especially important to note that there is another one after tag.

Export / Save Mirror

Docker save [IMAGE ID] > mcstest-160627019.tar

Import Mirror

Docker load-I mcstest-160627019.tar or docker load-- input rocketmq.tar or docker load < rocketmq.tar

After importing the image, modify repository and tag if the names of repository and tag are both none

Docker tag [image id] [name]: [version]

Delete Mirror

Docker rmi-f image_id # #-f: forcibly delete an image; image_id: image id

Run the service

Docker run-d-I-t-- name=mcssAppService-p 9180 env AGENT_ID= "MCSSAPP-WEB-ALL-27.60"-- env APP_NAME= "MCSSAPP-WEB-ALL"-- restart=always-v / IBM/project/logs/mcstest:/logs mcstest:1606462949

View the real version of the image

Docker image inspect nginx:latest | grep-I version

View the log

Docker logs-f service name docker logs-f-t-- since= "2017-05-31"-- tail=10 edu_web_1--details displays more information-f,-follow real-time output log, the last behavior of the current timestamp log-since string output log start date, that is, only output logs after the specified date. -- tail string shows the last number of lines of log. Default is all (for example:-tail=10: view the last 10 lines of log). )

View docker information

Docker info can get the root directory of docker Docker Root Dir: / IBM/docker

View the disk occupancy of the docker root path

Df-Th / IBM/docker

Docker container exposes multiple ports

Docker run-p:-p:

Find the jar or war of the released container service and copy it out

Docker inspect xxl-job-executor-mcssdocker cp xxl-job-executor-mcss:/mcss-executor/mcss-executor.jar. /

This is the end of this article on "what are the common commands in docker". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

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