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

How to implement controllable dotted line with CSS

Preface Using css to generate dotted lines is a p...

Summary of the use of CSS scope (style splitting)

1. Use of CSS scope (style division) In Vue, make...

iframe multi-layer nesting, unlimited nesting, highly adaptive solution

There are three pages A, B, and C. Page A contains...

How to understand SELinux under Linux

Table of contents 1. Introduction to SELinux 2. B...

Sample code for nginx to achieve dynamic and static separation

1. Simple configuration of nginx's dynamic an...

Summary of web design experience and skills

■ Website theme planning Be careful not to make yo...

VMware ESXi installation and use record (with download)

Table of contents 1. Install ESXi 2. Set up ESXi ...

Optimize MySQL with 3 simple tweaks

I don't expect to be an expert DBA, but when ...

Installation and use of Ubuntu 18.04 Server version (picture and text)

1 System Installation Steps OS Version:1804 Image...

Implementation example of scan code payment in vue project (with demo)

Table of contents Demand background Thought Analy...

A brief discussion on MySql views, triggers and stored procedures

view What is a view? What is the role of a view? ...

jQuery implements the function of adding and deleting employee information

This article shares the specific code of jQuery t...

MySQL GTID comprehensive summary

Table of contents 01 Introduction to GTID 02 How ...