Docker
安装Docker
环境查看
# 系统内核是 3.10 以上的
[root@kuangshen /]# uname -r
3.10.0-1160.59.1.el7.x86_64
# 系统版本
[root@kuangshen /]# 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"
安装
帮助文档
# 1、卸载旧的版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
# 2、需要的安装包
yum install -y yum-utils
# 3、设置镜像的仓库
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo # 默认是从国外的,很慢!
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo #建议安装阿里云的
#更新yum软件包索引
yum makecache fast
# 4、安装docker docker-ce 社区 ee 企业版
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# 5、启动docker
systemctl start docker
# 6、使用docker version 查看是否安装成功
# 7、测试hello world!
docker run hello-world
# 8、查看 hello-world 镜像
[root@kuangshen ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 7 months ago 13.3kB
卸载docker
# 1、卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
# 2、删除资源
rm -rf /var/lib/docker
rm -rf /var/lib/containerd