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 command usage of docker

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains the "basic command usage of docker". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the basic command usage of docker.

1. Search for images

Docker search image_name

2. Restart docker

Systemctl restart docker

3. Give image a new name to clone

Docker tag image1 image2:tagname

4. Start the image under the container

-d means the background starts. Put-I,-t,-d in front of the image name.

Docker run-itd image1

5. View the currently launched container

Docker ps

Check all the containers.

Docker ps-a

6. Delete the image

Docker rmi image1

7. Enter the container

Docker exec-it ID bash

8. Save the image

Docker commit-m "comment" containerID (started container) new_image_name

-a represents the author

9. Import the image

Cat image.tar.gz | docker import-centos6

10. The existing image is exported to a file

Docker save-o image_name.tar image_name

11. Use files to restore the local image

Docker load-input image_name.tar

Or

Docker load < image_name.tar

12. Upload your image to dockerhub's official website, but only if you register a user first.

Docker push image_name

Create a container, but do not start it

Docker create-it centos6 bash

14. Start the container

Docker start container_id

15. Enter the virtual terminal

Docker run-I-t centos bash

16. Let the container run in the background

Docker run-d

17. Customize the name of the container

Docker run-name web3-itd centos bash / /-- name

18. You can delete the container directly after exiting.

Docker run-- rm-it centos bash-c "sleep 30" / /-- rm Thank you for your reading. This is the content of "basic Command usage of docker". After the study of this article, I believe you have a deeper understanding of the basic command usage of docker, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report