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

Docker main command

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Docker main commands:

Download docker image:

Docker pull xxxx

View the image list:

Docker images

View all containers:

Docker ps-a

Start/stop docker container:

Docker start/stop 92959a6799c3 (92959a6799c3 is container ID)

Batch stop containers:

Docker stop $(docker ps-a-Q)

Delete the container:

Docker rm 92959a6799c3

Bulk delete containers:

Docker rm $(docker ps-a-Q)

Delete the local image:

Docker rmi 10.0.0.2:500/ming:1.0

Enter the existing container:

Docker attach 92959a6799c3

Upload docker image:

Docker tag image:ubuntu1604_v2 10.0.0.2:5000/ubuntu1604_v2docker push 10.0.0.2:5000/ubuntu1604_v2

Give ordinary accounts the permission to start docker containers:

Gpasswd-an aa docker

Start and enter the container:

$docker run-it ubuntu1604_v1 / bin/bash

Or

$docker run-it 10.0.0.2:5000/ubuntu1604_v1 / bin/bash

Mount the host directory to the container (the former host directory, followed by the container directory, which will be automatically generated if the container directory does not exist):

$docker run-it-v / home/super:/home/super 10.0.0.2:5000/ubuntu1604_v1 / bin/bash

Copy data from the host to the docker container:

Docker cp / home/aa 92959a6799c3:/home/

Copy data from the docker container to the host:

Docker cp 92959a6799c3:/home/aa / home/

Save the container as a mirror:

Docker commit 52f44bc1b909 image:ubuntu1604_v2

Export the docker container:

Docker export 52f44bc1b909 > aa.tar

Import the docker container as image:

Cat aa.tar | docker import-ubuntu16:1.0

Export image (0cdfc5c78542 is image ID):

Docker save 0cdfc5c78542 > aa.tar

Import image:

Docker load < aa.tar

Convert iso to image for docker:

Mkdir isomount-o loop ubuntu-14.04.3-server-amd64.iso iso/tar czfv ubuntu14043iso.tar.gz isocat ubuntu14043iso.tar.gz | docker import-ubuntu:server_14.04.3 (import image)

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