Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Docker in CentOS7

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to install Docker in CentOS7. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Installation

Docker officially provides a set of installation scripts to simplify the installation process, which can be used on CentOS systems:

Curl-sSL https://get.docker.com/ | sh

After executing this command, the script automatically prepares everything and installs Docker on the system.

However, due to the great wall, there may be some download errors when using this script in China. Some domestic cloud service providers have provided a modified version of this script to use the domestic Docker software source mirror installation, so as to avoid wall interference.

Mirror image

Select a domestic mirror image

Official accelerator in China

The copy code is as follows:

Sudo echo "DOCKER_OPTS=\"-registry-mirror= https://registry.docker-cn.com\"" > > / etc/default/docker

Official accelerators are recommended.

NetEase 163

The copy code is as follows:

Sudo echo "DOCKER_OPTS=\"-registry-mirror= http://hub-mirror.c.163.com\"" > > / etc/default/docker

At present, the NetEase mirror image has been relatively stable.

After modifying the default image repository, you need to restart docker to take effect:

Service docker restart

Use

Start Docker

Service docker start

Boot self-start

Sudo chkconfig docker on

Stop Docker

Service docker start

List of local images

Docker images

Use the images command to check and find that there are no mirrors in the current local area.

Search

Docker search hello

The following results are all the images we searched for related to "hello"

Pull the image

Docker pull hello-world

We tried to pull the image named "hello-world" from the repository

After the pull is successful, use the docker images command to check and find that the image has been pulled locally.

Run Mirror

Docker run hello-world

After running, the image will output the following information:

Image renaming

Docker tag hello-world hw

We renamed the previously downloaded "hello_world" image to "hw", and using the images command to view it, we will find that there is already an additional image named "hw" in the list.

Delete Mirror

Docker rmi hello-world

We have deleted the image named "hello_world". The parameters after rmi can also be image short ID, image length ID, image name or image summary.

Unloading

List installation packages

Yum list installed | grep docker

Delete installation package

Yum-y remove docker-engine.x86_64yum-y remove docker-engine-selinux.noarch

Delete images / containers, etc.

Rm-rf / var/lib/docker after reading the above, do you have any further understanding of how to install Docker in CentOS7? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report