Installation tutorial of docker in linux

Installation tutorial of docker in linux

The Docker package is already included in the default CentOS-Extras repository. So if you want to install docker, just run the following yum command:

[root@localhost ~]# yum install docker

Start the Docker service <br /> After the installation is complete, use the following command to start the Docker service and set it to start at boot:

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

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

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

Download the official CentOS image to your local computer

[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 used the "-i to capture standard input and output" and "-t to allocate a terminal or console" options. To disconnect from the container, type 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 Fedora and Ubuntu operating systems.

[root@localhost ~]# docker search ubuntu
[root@localhost ~]# docker search fedora

This is the end of this article about the installation of docker in linux. For more relevant linux docker installation content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker installation and deployment example on Linux
  • Install Docker environment in Linux environment (no pitfalls)

<<:  Record of the actual process of packaging and deployment of Vue project

>>:  MySQL complete collapse: detailed explanation of query filter conditions

Recommend

Learn Node.js from scratch

Table of contents url module 1.parse method 2. fo...

Database SQL statement optimization

Why optimize: With the launch of the actual proje...

How to use the dig/nslookup command to view DNS resolution steps

dig - DNS lookup utility When a domain name acces...

Use of Linux bzip2 command

1. Command Introduction bzip2 is used to compress...

Detailed instructions for installing mysql5.7 database under centos7.2

The mysql on the server is installed with version...

Solve the problem of specifying udp port number in docker

When Docker starts a container, it specifies the ...

How to reset your Linux password if lost

1. The startup menu is to move the cursor to the ...

Why does your height:100% not work?

Why doesn't your height:100% work? This knowl...

How to use Nginx to prevent IP addresses from being maliciously resolved

Purpose of using Nginx Using Alibaba Cloud ECS cl...

A detailed summary of HTML tag nesting rules suitable for beginners

I have been relearning HTML recently, which can be...

Two ways to make IE6 display PNG-24 format images normally

Method 1: Please add the following code after <...