10 minutes to teach everybody how to play Docker and this is
1. Preface
Into the cloud computing era, the major cloud provider AWS, Aliyun have launched for Docker services, now Docker is very hot, then Docker what is, let us experience.
2. What is Docker?
Docker is an open source application container engine that allows applications and dependencies to be placed in a portable container and then published on any popular Linux system, virtualization in this way.
Mention virtualization, we should be very familiar with, there are many VMWARE,XEN,KVM and so on. So, what is the difference between Docker and VM, we use a picture of the official website to explain.
As can be seen, Docker and VM comparison, with the Docker engine instead of Hyper-V, no gest OS, the application is placed in the container, run directly on the host's OS.
The advantage of this is that although the containers are isolated from each other, shared system resources and common libraries, stripped of the Gest OS layer, the system resource utilization is higher.
In addition, because the flexibility of the Docker container, in the development of the program → Test → release, the whole process can ensure the consistency of the environment, and greatly reduce the workload and time. This is the main reason why Docker is very popular.
Speaking of which, you may not be able to wait, let's use the Docker.
3. Use Docker
There are some common mirrors on the official Docker hub, which can be used directly in the container, or you can create a mirror of your own to be saved for use by the container. Today, a Nginx container is created using a common mirror.
3.1 Installation Docker
Docker installation is very simple, with Yum or apt-get can be directly installed.
# Yum Install-y Docker
3.2 Start Docker
# service Docker Start
3.3 View Information
# Docker Info
Install to this end, and then create a Nginx container.
3.4 Looking for mirrors
Look for nginx mirrors on the Docker hub.
# Docker Search Nginx
3.5 Capture Mirrors
We are downloading the official Nginx mirror.
# Docker Pull Nginx
3.6 Viewing mirrors
# Docker Images
3.7 Fixed mirror create container and start
Specifies the Nginx mirror that you just acquired.
# Docker run-d-P 80:80--name cn1 Nginx
Explain the parameters:
-D put in background execution
-P Host Port: The container port maps the port of the container to the host, in order to provide access directly to the external
--name Specify container Name
3.8 Viewing containers
# docker PS
In the browser to access the server's IP, you can open the Nginx default page
To this, a Nginx container has been created successfully. Here are some other commands.
3.9 End Container
# Docker Kill Cn1
3.10 View all containers
# Docker Ps-a
3.11 Startup container
# Docker Start Cn1
3.12 Delete Container
# Docker RM Sad_heisenberg
4, PostScript
This article is just a simple introduction to Docker, other uses, will be introduced in the future, please continue to pay attention to this blog.
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.