Docker is an open source application container engine that can easily create a lightweight, portable, and self-sufficient container for any application. Using Linux's LXC, AUFS, Go language, and cgroup to achieve resource independence, you can easily achieve file, resource, network isolation, and its ultimate goal is to achieve application isolation similar to the PaaS platform.
Docker features worth paying attention to:
File system isolation: Each process container runs in a completely independent root file system.
Resource isolation: System resources, such as CPU and memory, can be allocated to different containers, using cgroups.
Network isolation: Each process container runs in its own network space, virtual interface and IP address.
Logging: Docker will collect and record the standard stream (stdout/stderr/stdin) of each process container for real-time retrieval or batch retrieval.
Change management: Changes to the container file system can be submitted to a new image and can be reused to create more containers. No need to use templates or manual configuration.
Interactive shell: Docker can allocate a virtual terminal and associate it with the standard input of any container, such as running a one-time interactive shell.
Docker is usually used in the following scenarios:
Automatic packaging and publishing of web applications;
Automated testing and continuous integration and release;
Deploy and adjust databases or other background applications in a service-oriented environment;
Compile or extend the existing OpenShift or Cloud Foundry platform from scratch to build your own PaaS environment.
I am using CentOS6.8 here.
Note: other sources may cause the version of your kernel and docker to be inconsistent, you need to upgrade the kernel to 3.x.
installation:
1[ root@localhost ~]# rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
2 Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
3 warning:/var/tmp/rpm-tmp.JN76fI: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
4 Preparing... ########################################### [100%]51:epel-release ########################################### [100%]6[root@localhost ~]# rpm --import/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-678[root@localhost ~]# yum -y install docker-io
910 Start and set to start automatically
1112[ root@localhost ~]# service docker start
13 Starting cgconfig service:[determine]14 Starting docker:[determine]15[root@localhost ~]# chkconfig docker on
Get centos mirror
[ root@localhost ~]# docker pull hub.c.163.com/public/centos:6.7
The official installation method docker pull imagename is downloaded from the index center of docker, imagename is the image name, for example, docker pull Ubuntu is to download base ubuntu and the tag is latest.
Due to the slow speed of domestic access to the Docker hub directly, the time to pull the image will be longer. Generally, we will use mirror acceleration or pull directly from some domestic platform mirror warehouses.
List two commonly used ones:
NetEase Mirror Center: https://c.163.com/hub#/m/home/
daocloud mirror market: https://hub.daocloud.io/
View docker image
Run docker run shell
View container information
Stop container
[ root@localhost ~]# docker stop <CONTAINER ID>
**Delete the container (docker rm): **
docker ps -a #Get container name
docker rm container_name
Delete all containers
docker rm $(docker ps -a -q)
New to contact.
Recommended Posts