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 centos

2025-03-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to install docker in centos, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Centos docker installation

Docker supports the following centos versions:

Centos 7 (64-bit)

Centos 6.5 (64-bit) or later

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, requiring 64-bit system and kernel 2.6.32-431 or later.

Check your own kernel

The uname command is used to print information about the current operating system, including kernel version number, hardware architecture, hostname, operating system type, and so on.

[root@t-docker chenzx] # uname-a

Linux t-docker 3.10.0-862.11.6.el7.x86_64 # 1 SMP Tue Aug 14 21:49:04 UTC 2018 x86 "64 GNU/Linux

Voiceover: docker technology came out in 2013 and became popular in 2017.

View the installed version of ceonts

[root@t-docker chenzx] # lsb_release-aLSB Version::core-4.1-amd64:core-4.1-noarchDistributor ID:CentOSDescription:CentOS Linux release 7.5.1804 (Core) Release:7.5.1804Codename:Corecentos 6.5 and above install docker

Install docker on centos6, some functions are not available, so it is recommended to install it on centos7.

1. Yum install-y eple-replease

2. Yum install-y docker-io (centos7 is docker-ce)

If it doesn't fit, do it with the following command:

Yum install https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

3. Configuration file after installation, / etcsysconfig/docker

4. Start the backend service: service docker start

5. Verification of docker version command

Docker release not

The docker version of CE is the open source version. EE is an enterprise edition.

Install docker on centos7

Official website document: https://docs.docker.com/

Installation documentation address: https://docs.docker.com/install/linux/docker-ce/centos/

Chinese installation address: https://docs.docker-cn.com/engine/installation/linux/docker-ce/centos

1. Uninstall the old version of docker

$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

2. Install the dependency package

Yum- y install gcc gcc-c++yum install-y yum-utils\ device-mapper-persistent-data\ lvm2

3. Add repo of docker

Yum-config-manager\-- add-repo\ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # accelerates with Ali Cloud, which means to download the docker-ce.repo file to / etc/yum.repod/

4. Update the index of yum software package

Yum makecache fast

5. Install docker

Yum-y install docker-ce

Note: if you report an error of container-selinux > = 2.9, then:

Wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repoyum install epel-releaseyum install container-selinux yum-y install docker-ce

6. Start docker

Systemctl start docker

7. Testing

[root@t-docker chenzx] # docker versionClient: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:23:03 2018 OS/Arch: linux/amd64 Experimental: falseServer: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:25:29 2018 OS/Arch: linux/amd64 [root@t-docker chenzx] # docker run hello-workd [root@t-docker chenzx] # docker imageshello-world latest 2cb0d9787c4d 6 weeks ago 1.85kBREPOSITORY TAG IMAGE ID CREATED SIZE

8. Configure image acceleration

Vim / etc/docker/daemon.json (not created for this file) # docker Chinese {"registry-mirrors": ["https://registry.docker-cn.com"]}# NetEase Cloud {" registry-mirrors ": [" http://hub-mirror.c.163.com"]}# Ali Cloud {"registry-mirrors": ["https:// 's own code .mirror.aliyuncs.com"]} systemctl daemon-reloadsystemctl restart docker [root@t -docker chenzx] # ps-elf | grep docker4 S root 1009 10 800-232175 futex_ Aug25? 00:03:24 / usr/bin/dockerd4 S root 1036 1009 0 800-110929 futex_ Aug25? 00:02:53 docker-containerd-- config / var/run/docker/containerd/containerd.toml [root@t-docker chenzx] # docker search tomcat

9. Uninstall docker

Systemctl stop dockeryum-y remove docker-cerm-rf / var/lib/docker Thank you for reading this article carefully. I hope the article "how to install docker in centos" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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