(Low title repetition rate) Docker basic operation

I've been using Docker all the way, and I don't remember all the way. If I don't remember it, it's Baidu. It's better to remember one. The big guy has always called others Baidu, how can he Baidu.

----------------View the mirror--------------------

If you, like me, use Docker once a year and don’t like to remember, then there must be this problem:

docker images

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Solution:

sudo su

service docker start

---------------View junk---------------------

sudo du -hs / var / lib / docker

-------------- Load the image package to the local mirror warehouse ------------------------

If the great pot of heaven is for you, the image package named XXX.tar

sudo docker load --input XXX.tar 
and then input sudo docker images to see this thing in the local mirror warehouse.

---------------Run the image (create a container) --------------------

sudo docker run --name cy [container name]  -it -p 2200:2200 -v /home/dl/yw/cy [host external folder] :/cy [container internal folder] XXX [image name (don’t tar Suffix)] :2.0 [version number]  /bin/bash
Then you enter the container, you exit again , and you exit the container again.

---------------View container------------------

sudo docker ps -a

---------------Run the container------------------ 

Suppose you have created a container, but exited, and now you want to go in again.

sudo docker start -ia cy [container name]

---------------Delete the container------------------ 

sudo docker rm cy [container name]

---------------Packing the modified image------------------ 

sudo docker save -o XXXX [new name] .tar XXX [old name] :2.0 [version number]

---------------Delete the mirror------------------ 

sudo docker rmi ID [Mirror image IMAGE ID]

 

all in all:

The local mirror library has a bunch of images, and each image can have a bunch of containers.

The original image can be downloaded from the Docker official website, and then modified and packaged into your own image.

Guess you like

Origin blog.csdn.net/XLcaoyi/article/details/106083219