Docker is a new way to achieve a super lightweight virtual machine, in the implementation of the principle and application or VM has a huge difference, the professional name is the application container (application Container). (I personally prefer to call it a virtual machine)
The Docker application container has several advantages over VMS:
- The startup speed is fast, the container usually starts in a second, and the VM usually takes longer
- High resource utilization, a common PC can run thousands of containers, you run thousands of VMs to try
- Low performance overhead, the VM typically requires additional CPU and memory to complete the OS functionality, which takes up additional resources
Docker installation
Install Docker on CentOS6
# yum-y Install epel-release
# yum-y Install Docker-io
Install Docker on CentOS7
Start Docker
#/etc/init.d/docker Start
If there is no process after startup, the log appears:
/usr/bin/docker:relocation Error:/usr/bin/docker:symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
Solution:
# Yum Upgrade Device-mapper-libs
Docker Mirroring Management
# Docker Pull CentOS//Get CentOS Mirror from docker.com
# Docker images//View what mirrors are on
The local # docker tag CentOS Fansik//For CentOS mirroring settings Label is Fansik, then use Docker images view will come out one more line, the image ID of the line and CentOS of the same
# docker search [Image-name]//From the Docker warehouse searching Docker mirrors, The following is the keyword
# docker run-t-I centos/bin/bash//Open the container with the download to the mirror, and-I means to let the container's standard input open,-T to assign a pseudo terminal, to place-I and-T in front of the mirror name
Once the mirror has been modified, we can regenerate a new version of the mirror submission and then local
Docker PS//view running containers, plus-a option to view containers that are not running
Docker RMI CentOS//used to remove specified mirrors, the following parameters can be tag, if it is tag, the actual deletion is the tag, as long as the mirror image and other tag, will not delete the mirror, when the following parameter is the mirror ID, it will completely remove the entire mirror, Delete together with all tags
# Docker Tag CentOS Centos:fansik create a mirror repository Centos,tag as Fansik
# Docker RMI Centos:fansik Delete repository as Centos,tag Fansik Mirror
Docker mirrors use containers to generate new mirrors
Enter the container you created before
- # docker ps-a; see what containers are there
- # Docker start dad4e9070e2b a container with a boot ID of dad4e9070e2b (ID can be abbreviated to the first few)
- # docker exec-it Dad4e9070e2b/bin/bash into the container
- You can use Yum to install the required software directly
After running Docker run, go into the container and we make some changes, such as installing something, and then creating a new mirror for the container
Docker commit-m "Change somth"-a "Somebody info" container_id (get ID via Docker ps-a) New mirror name
For example: Docker commit-m "Install httpd"-a "aming" dad4e9070e2b Aming/centos
This command is a bit like SVN's submission, M plus some change information,-a specifies the author-related information dad4e9070e2b as the container ID, followed by the name of the new mirror
Docker create a mirror based on a local template import
- Module extraction, you can download a module directly on the Web (you can copy the link and then direct wget) http://openvz.org/Download/templates/precreated
- The command to import a mirror is: # cat ubuntu-15.10-x86_64-minimal.tar.gz | Docker Import-ubuntu
- To export an existing mirror to a file: # Docker Save-o Fansik-httpd.tar httpd (warehouse name or mirror ID)
- Restore local mirrors with backup files: # Docker load--input Fansik-httpd.tar or: # Docker load < Fansik-httpd.tar
- Upload your own image to Dockerhub's official website, but you need to register the user Docker push Image_name
Original link: http://www.cnblogs.com/fansik/p/5526938.html
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.