-
记录下在CentOS7中安装Docker CE
1. 卸载系统中可能存在的老版本
-
在CentOS中,老版本Docker的软件包名是docker或docker-engine,而Docker CE的软件包名称是docker-ce。因此,若已安装过老版本的Docker,需使用如下命令卸载
-
//复制如下代码,在Linux上直接执行
sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine
-
- 需要注意的是,执行该命令只会卸载Docker本身,不会删除Docker存储的文件,例如镜像、容器、卷以及网络文件等。这些文件保存在/var/lib/docker目录中,需要手动删除。
2. 开始安装docker CE
-
复制执行以下命令,安装Docker所需的包。其中:
- yum-utils: 提供yum-conf ig-manager的工具;
- device-mapper-persistent-data及lvm2: 是devicemapper存储驱动所需的包.
-
-
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
-
-
复制执行如下命令,安装stable仓库。必须安装stable仓库,即使你想安装edge或test仓库中的Docker构建版本。
-
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
-
-
[可选 ]执行如下命令,启用edge及test仓库。edge/test仓库中其实也包含在了docker.repo文件中,但默认是禁用的,可使用以下命令启用
-
sudo yum-config-manager --enable docker-ce-edge #启动edge仓库, 如果想要禁用将enable改为disable即可 sudo yum-config-manager --enable docker-ce-test #启动test仓库
-
-
复制执行以下命令,更新yum的包索引
-
sudo yum makecache fast
-
-
复制执行如下命令即可安装最新版本的Docker CE
-
sudo yum install docker-ce
-
-
启动docker
-
sudo systemctl start docker
-
-
验证安装是否正确
-
sudo docker run hello-world
-
返回结果如下
-
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world b8dfde127a29: Pull complete Digest: sha256:7d91b69e04a9029b99f3585aaaccae2baa80bcf318f4a5d2165a9898cd2dc0a1 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
-
-
-
卸载:
-
12
sudo yum remove docker-ce #卸载docker-ce
sudo rm -rf /
var
/lib/docker #强制删除docker相关文件
-
使用脚本来安装Dockers
-
依次执行如下命令:
-
1
curl -fsSL
get
.docker.com -o
get
-docker.sh
-
1
sudo sh
get
-docker.sh
-
出处:https://www.cnblogs.com/yaocode/p/15233258.html
最新更新
求1000阶乘的结果末尾有多少个0
详解MyBatis延迟加载是如何实现的
IDEA 控制台中文乱码4种解决方案
SpringBoot中版本兼容性处理的实现示例
Spring的IOC解决程序耦合的实现
详解Spring多数据源如何切换
Java报错:UnsupportedOperationException in Col
使用Spring Batch实现批处理任务的详细教程
java中怎么将多个音频文件拼接合成一个
SpringBoot整合ES多个精确值查询 terms功能实
数据库审计与智能监控:从日志分析到异
SQL Server 中的数据类型隐式转换问题
SQL Server中T-SQL 数据类型转换详解
sqlserver 数据类型转换小实验
SQL Server数据类型转换方法
SQL Server 2017无法连接到服务器的问题解决
SQLServer地址搜索性能优化
Sql Server查询性能优化之不可小觑的书签查
SQL Server数据库的高性能优化经验总结
SQL SERVER性能优化综述(很好的总结,不要错
uniapp/H5 获取手机桌面壁纸 (静态壁纸)
[前端] DNS解析与优化
为什么在js中需要添加addEventListener()?
JS模块化系统
js通过Object.defineProperty() 定义和控制对象
这是目前我见过最好的跨域解决方案!
减少回流与重绘
减少回流与重绘
如何使用KrpanoToolJS在浏览器切图
performance.now() 与 Date.now() 对比