I. Overview
Docker is an application container engine open source, so developers can package their applications and dependencies into a portable container and then posted to any popular Linux machine or Windows machine, can be virtualized, the container is completely use the sandbox mechanism will not have any interface with each other.
-
DockerClient client
-
Docker Daemon Daemon
-
Docker Image Mirror
-
Docker Container vessel
The core technology of the container has the following core technologies:
1.cgroups resource management (limit space)
2.Namespace process isolation
3.SElinux security
Here are a comparison chart docker container and traditional virtualization technology, it is clear to see why docker faster speed than traditional virtualization, because the operating system does not docker
That it can be understood as a program (not account for memory, cpu, speed) and this is the biggest difference between traditional virtualization
docker also has its own shortcomings
1. Isolation of the container is not strong virtualization
2. Shared Linux kernel, security birth defects
3.selinux restive
4. Monitoring container and troubleshooting
II: Installation Requirements
1.64 operating system
2. At least RHEL6.5 version of the above, the personal version is strongly recommended RHEL7.0
3. Turn off the firewall (not required)
4. The kernel version must be 3.10 or more, you can check the kernel version by command uname -r
Three: Installation docker
1. docker already installed, you need to uninstall
命令:yum -y remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
Because I am a new virtual machine, docker history does not install
2. Installation docker dependencies
命令:yum -y install yum-utils device-mapper-persistent-data lvm2
There are two ways to download docker sources, one official, one is cloud Ali, Ali recommended to use personal cloud
Command: cd /etc/yum.repos.d/
Official website address: yum-config-Manager - the Add-repo HTTPS: //download.docker.com/linux/centos/docker-ce.repo
Ali Cloud Address: yum-config-Manager - the Add-repo HTTP: //mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3. formal installation docker
命令:yum -y install docker-ce
4. Start docker and testing
Command: systemctl start docker # start docker
Testing: docker run hello-world
After executing the command docker, if the content is consistent with the following figure indicates success
Or enter ip a (ifconfig) will appear as shown, the installation is successful
Docker environmental information
Docker --info command for detecting correct installation, generally binding docker version command. --version command
Mirroring list of common
docker images to view mirror list Example: docker images
docker history View mirroring the historical example: docker history docker.io/centos
docker inspect the underlying information to view mirror Example: docker inspect docker.io/centos
Example docker pull download the image: docker pull centos Example: docker pull seanlook / centos: centos6
docker push image uploaded Example: docker push seanlook / mongo
docker rmi delete local mirror cases: docker rmi docker.io/centos
docker save save mirror image derived tar packets Example: docker save docker.io/busybox:latest -o busybox.tar (exported in the mirror to busybox.tar)
Example mirror docker load introduced: docker load -i Nginx .tar
docker search image search Example: docker search docker.io/centos
docker tag name and image edit tags Example: docker tag docker.io/centos:latest cen: v1 and the image name tags docker.io latest changed cen: v1 latest set as the default
Container common list
Example container docker run run: docker run -d Docker . IO / Nginx
docker ps to see running container docker ps -a to view a list of all containers docker ps -aq display only container id
See docker stop closing the container and then close the container id operation Example: docker stop b8f
docker start open container above
docker restart to restart the container above
After docker attach / exec attach into the container into the container exit exit will lead container is closed does not close the container docker attach b8f2 into the container when the exec exit
docker inspect the container bottom view information docker inspect b8f
docker top view a list of container docker top b8f2
To delete an error message appears first closed container docker rm delete container docker rm b8f2 container operation