centos7下安装docker

环境要求

基础环境
[root@VM_59_161_centos ~]# uname -r
3.10.0-514.21.1.el7.x86_64
[root@VM_59_161_centos ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

安装docker

安装需要的软件包
[root@VM_59_161_centos ~]# yum install -y yum-utils
设置阿里云镜像仓库
[root@VM_59_161_centos ~]# sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@VM_59_161_centos ~]# 
更新yum软件包索引

推荐安装docker-ce

[root@VM_59_161_centos ~]# yum makecache fast
安装docker

推荐安装docker-ce

[root@VM_59_161_centos ~]# yum install docker-ce docker-ce-cli containerd.io
启动docker,查看版本

推荐安装docker-ce

[root@VM_59_161_centos ~]# systemctl start docker
[root@VM_59_161_centos ~]# docker --version
Docker version 20.10.0, build 7287ab3

到此为止,docker已成功安装

你可能感兴趣的:(centos7下安装docker)