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:
- [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:
- [root@localhost ~]# service docker start
- [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:
- [root@localhost ~]# systemctl start docker.service
- [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. )
- [root@localhost ~]# docker pull centos
- Pulling repository centos
- 192178b11d36: Download complete
- 70441cac1ed5: Download complete
- ae0c2d0bdc10: Download complete
- 511136ea3c5a: Download complete
- 5b12ef8fd570: Download complete
Confirm that the CentOS image has been obtained:
- [root@localhost ~]# docker images centos
- REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
- centos centos5 192178b11d36 2 weeks ago 466.9 MB
- centos centos6 70441cac1ed5 2 weeks ago 215.8 MB
- centos centos7 ae0c2d0bdc10 2 weeks ago 224 MB
- centos latest ae0c2d0bdc10 2 weeks ago 224 MB
Run a Docker container:
- [root@localhost ~]# docker run -i -t centos /bin/bash
- [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.
- [root@cd05639b3f5c /]# cat /etc/redhat-release
- CentOS Linux release 7.0.1406 (Core)
- [root@cd05639b3f5c /]# exit
- exit
- [root@localhost ~]#
We can also search for containers based on the Fedora and Ubuntu operating systems.
- [root@localhost ~]# docker search ubuntu
- [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