目录
安装docker(环境CentOS8)
- 环境准备
- 1、需要会一点点的Linux的基础
- 2、CentOS 7以上
- 3、使用Xshell连接远程服务器进行操作
- 环境查看
- #系统内核是3.10以上的
- 查看命令:uname -r
- 查看配置命令:cat /etc/os-release
安装
- 这里我使用的是Centos,选择对应的版本
第一步:卸载旧的版本
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
第二步:安装必要的包
yum install -y yum-utils
第三步:设置镜像的从仓库
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软件包索引
CentOS 7: yum makecache fast CentOS 8: dnf makecache timer -- dnf makecache --help查看具体操作
第五步:安装docker
- 安装docker相关的内容 docker-ce是社区版 ee是企业版 推荐使用ce
yum install docker-ce docker-ce-cli containerd.io
- 出现问题,此处参考:http://www.mamicode.com/info-detail-2986019.html
- 解决方案:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
- 只要安装第一个就可以了,因为安装它后其它的依赖就自动安装上。
yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.2-3.3.el7.x86_64.rpm
- 再继续安装docker
*指定版本安装(参考即可)
yum list docker-ce --showduplicates | sort -r docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
第六步:启动docker,查看版本
systemctl start docker docker version
第七步:hello-world
docker run hello-world
第八步:查看下载的hello-world镜像
docker images
**卸载docker
# 1.卸载依赖 yum remove docker-ce docker-ce-cli containerd.io # 2.卸载资源 rm -rf /var/lib/docker
- /var/lib/docker docer的默认工作路径
安装docker(环境CentOS8)
猜你喜欢
转载自blog.csdn.net/baidu_41388533/article/details/108524869
今日推荐
周排行