How to install Docker on CentOS 7

Source: Internet
Author: User

How to install Docker on CentOS 7

Docker is an open-source tool that allows creation and managementLinux containerEasy to use. Containers are like lightweight virtual machines and can be started or stopped in milliseconds. Docker helps system administrators and programmers develop applications in containers and can expand to thousands of nodes.

The main difference between a container and a vmvm is that the container providesProcess-based isolationVirtual machines provide full isolation of resources. The virtual machine may take one minute to start, while the container only takes one second or less. Containers use the kernel of the host operating system, while virtual machines use an independent kernel.

One of the limitations of Docker is that it can only be used in64-bit.

In this article, we will discuss how to install docker in CentOS 7.x.

Docker installation in CentOS 7

The Docker package is included in the default CentOS-Extras software source. To install docker, run the following yum command:

 
 
  1. [root@localhost ~]# yum install docker
Start the Docker Service

After the installation is complete, run the following command to start the docker service and set it to boot:

 
 
  1. [root@localhost ~]# service docker start
  2. [root@localhost ~]# chkconfig docker on

The old sysv syntax is used here. For example, the new systemd syntax supported in CentOS 7 is used as follows:

 
 
  1. [root@localhost ~]# systemctl start docker.service
  2. [root@localhost ~]# systemctl enable docker.service

)

Download the official CentOS image to your local device.LCTT Note: Because Docker isWall:-<, So please use the http://docker.cn image, thanks @ Ma Quan one image. )

 
 
  1. [root@localhost ~]# docker pull centos
  2. Pulling repository centos
  3. 192178b11d36: Download complete
  4. 70441cac1ed5: Download complete
  5. ae0c2d0bdc10: Download complete
  6. 511136ea3c5a: Download complete
  7. 5b12ef8fd570: Download complete

Confirm that the CentOS image has been obtained:

 
 
  1. [root@localhost ~]# docker images centos
  2. REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
  3. centos centos5 192178b11d36 2 weeks ago 466.9 MB
  4. centos centos6 70441cac1ed5 2 weeks ago 215.8 MB
  5. centos centos7 ae0c2d0bdc10 2 weeks ago 224 MB
  6. centos latest ae0c2d0bdc10 2 weeks ago 224 MB

Run a Docker container:

 
 
  1. [root@localhost ~]# docker run -i -t centos /bin/bash
  2. [root@dbf66395436d /]#

We can see that the CentOS container has been started and we get a bash prompt. In the docker command, we use the "-I capture standard input and output" and "-t assign a terminal or console" options. To disconnect from the container, enter exit.

 
 
  1. [root@cd05639b3f5c /]# cat /etc/redhat-release
  2. CentOS Linux release 7.0.1406 (Core)
  3. [root@cd05639b3f5c /]# exit
  4. exit
  5. [root@localhost ~]#

We can also search for containers based on the Fedora and Ubuntu operating systems.

 
 
  1. [root@localhost ~]# docker search ubuntu
  2. [root@localhost ~]# docker search fedora

Display the list of currently running containers

Via: http://www.linuxtechi.com/install-docker-on-centos-7/

Author: Pradeep Kumar Translator: felixonmars Proofreader: wxy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.