Basic management of Docker images and containers, docker image containers
Three major Docker component repositories, images, and containers
Image images
Use docker images to view local images
(REPOSITORY: TAG of the REPOSITORY and TAG from, for example, latest. Image id: ID of the IMAGE, CREATED: Creation Time, SIZE: SIZE of the IMAGE.) I have no IMAGE, so nothing is displayed.
How to obtain an images can be downloaded from a public repository or created by yourself
First, download
Search for images docker search centos (centos keyword)
After finding images, we need to download it.
Docker pull Image Location; for example, docker pull docker. io/centos (the image is being downloaded)
(Download successful)
Now we can check the image (now we can see the image we just downloaded)
The above method is the image we downloaded from the public warehouse. How do we make the image? First, we should have a basic image to facilitate our expansion.
The following is a demonstration (I will use the image I just downloaded)
First, we will remember the container ID when running a container using an image to start.
After running the command, you can perform the operations required by the container. For example, you can install a web site.
Use the docker commint command to create an image
View images
We will find that one more one is the one we created.
Next, I will introduce a method for importing images.
Import from local file
We can download a template from the website and import it to the docker host.
Import and use the docker import command
Then we can view
Container Management
Containers are another core concept of Docker. Simply put, containers are one or more applications that run independently and Their runtime environments. The virtual machine can be understood as a complete set of operating systems (providing a running environment and other system environments) and running applications.
Container after startup
You can use docker ps to view container processes.
I haven't run the container yet, so I haven't)
We can use docker start to start a stopped container.
When we view it again, we will find that a container is running.
If you want to disable or stop docker, you can use docker kill [container ID] or docker stop [container ID] to restart docker restart [container ID]