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 and use Docker CE under Centos

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

Share

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

This article mainly explains "how to install and use Docker CE under Centos". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and use Docker CE under Centos.

prerequisite

Currently, only kernels in CentOS distributions support Docker.

Docker runs on CentOS 7 and requires a 64-bit system with a kernel version of 3.10 or above.

Docker runs on CentOS-6.5 or later CentOS and requires the system to be 64-bit and the system kernel version 2.6.32-431 or later.

Install using yum (under CentOS 7)

Docker requires the kernel version of the CentOS system to be higher than 3.10. check the prerequisites on this page to verify that your version of CentOS supports Docker.

Check your current kernel version with the uname-r command

[root@runoob ~] # uname-r 3.10.0-327.el7.x86_64 install Docker

Since March 2017, docker has been divided into two branch versions: Docker CE and Docker EE.

Docker CE, the community free version, and Docker EE, the enterprise version, emphasize security, but you need to pay for it.

Remove the old version:

$sudo yum remove docker\ docker-client\ docker-client-latest\ docker-common\ docker-latest\ docker-latest-logrotate\ docker-logrotate\ docker-selinux\ docker-engine-selinux\ docker-engine

Install some necessary system tools:

Sudo yum install-y yum-utils device-mapper-persistent-data lvm2 add software source information: sudo yum-config-manager-- add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo update yum cache: sudo yum makecache fast install Docker-ce:sudo yum- y install docker-ce start Docker backend service sudo systemctl start docker test run hello-world [root@runoob ~] # docker run hello-world

Since there is no hello-world image locally, a hello-world image will be downloaded and run in the container.

Install Docker using a script

1. Log in to Centos with sudo or root permissions.

2. Make sure the yum package is up to date.

$sudo yum update

3. Execute Docker installation script.

$curl-fsSL https://get.docker.com-o get-docker.sh$ sudo sh get-docker.sh

Executing this script adds the docker.repo source and installs Docker.

4. Start Docker process.

Sudo systemctl start docker

5. Verify that docker is installed successfully and execute a test image in the container.

$sudo docker run hello-worlddocker ps

At this point, the installation of Docker on the CentOS system is complete.

Mirror acceleration

In view of the domestic network problems, it is very slow to pull the Docker image later. We can configure an accelerator to solve it. I use NetEase's image.

The new version of Docker uses / etc/docker/daemon.json (Linux) or% programdata%\ docker\ config\ daemon.json (Windows) to configure Daemon.

Please add to the configuration file (if there is no such file, please create one first):

{"registry-mirrors": ["http://hub-mirror.c.163.com"]} deletes Docker CE

Execute the following command to delete the Docker CE:

Sudo yum remove docker-ce$ sudo rm-rf / var/lib/docker so far, I believe you have a better understanding of "how to install and use Docker CE under Centos". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report