docker

#Concept

Image: An image is a read-only template with instructions for creating a Docker container.

Container:A container is a runnable instance of an image.

Registries: A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. 

 

 

 

#list the images

docker images

#list the containers

docker ps -a

 

#remove contains
docker rm xxxxx xxxx

 

#remove images
docker rmi xxxxx xxxx

 

#run a image 

docker run -it ubuntu:latest \bin\bash

exit : quit the running ubuntu

using docker ps -a, you can see the container running, later you can docker start -i container_id

 

#share folder

docker run -it -v ~/share-docker:/share ubuntu 
 
#docker images location
/var/lib/docker/ 
 
#save a image to file
docker image save ubutun-aaa -o ~/docker/newimage
save image does not keep the changes
 
#create a new image from base container
docker commit 7a45748d2673 ubuntu-fpa1000
 
#Export a container's filesystem as a tar archive
docker export ubuntu-xx -o ~/Documents/docker/ubuntu-xxx
 
#load a image from a file
docker load -i the_export_file

posted on 2020-07-21 16:32  荷树栋  阅读(122)  评论(0)    收藏  举报

导航