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 under CentOS7

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

Share

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

This article is about how to install Docker under CentOS7. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Check the environmental conditions of installation

Installation of docker requires a 64-bit system with a kernel version greater than 3.10.

So if it is CentOS, you must install CentOS7.0 or above.

We are using CentOS7.2 mininul here.

Uname-r

3.10.0-327.28.3.el7.x86_64

Perform a system-wide software version upgrade before installing docker:

Yum-y update

two。 Install docker

Sudo yum install-y-nogpgcheck\

Http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7/Packages/docker-engine-selinux-1.10.3-1.el7.centos.noarch.rpm\

Http://mirrors.aliyun.com/docker-engine/yum/repo/main/centos/7/Packages/docker-engine-1.10.3-1.el7.centos.x86_64.rpm

3. Fix a configuration.

"DOCKER_NETWORK_OPTIONS=\"-H tcp://0.0.0.0:2375-H unix:///var/run/docker.sock\ "> > / etc/sysconfig/docker

4. Start

Service docker start

5. Verification

Docker info

CentOS 7 installs Docker repository 1. About Registry

The official registry image (details) is provided on Docker hub. We can directly use this registry image to build a container and build our own private repository service. The registry image whose Tag is latest is version 0.9.1, so we directly use version 2.1.1.

2. Deployment of Registry

Run the following command to get the registry image

$sudo docker pull registry:2.1.1

Then start a container.

$sudo docker run-d-v / opt/registry:/var/lib/registry-p 5000 restart=always-- name registry registry:2.1.1

By default, the Registry service will save the uploaded image in the / var/lib/registry of the container. By mounting the / opt/registry directory of the host to this directory, you can save the image to the / opt/registry directory of the host.

# sudo docker run-d-v / data/registry:/var/lib/registry-p 5000 restart=always-- name registry registry:2.1.1

Run docker ps to check the container

$sudo docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESf3766397a458 registry:2.1.1 "/ bin/registry / etc/d" 46 seconds ago Up 45 seconds 0.0.0.0pur5000-> 5000/tcp registry

It means that we have started the registry service. Open a browser and enter http://127.0.0.1:5000/v2. The following situation indicates that registry is running normally.

3. Verification

Now let's verify it by push the image to registry. There is an image of hello-world on my machine, and we need to mark it to be pushed to a private warehouse through docker tag.

$sudo docker tag hello-world 127.0.0.1:5000/hello-world

Then view the following local images

Next, we run docker push to push the hello-world image into our private repository

Now we can check that we have just pushed the hello-world in our local / data/registry directory. We also enter http://127.0.0.1:5000/v2/_catalog in the browser, as shown in the following figure

Now we can delete our local 127.0.0.1:5000/hello-world and hello-world first.

$sudo docker rmi hello-world$ sudo docker rmi 127.0.0.1:5000/hello-world

Then use docker pull to get the hello-world image from our private repository

Thank you for reading! This is the end of the article on "how to install Docker under CentOS7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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