Docker卸载与安装

卸载旧的版本

卸载

yum -y remove docker-ce docker-cli-io containerd.io
rm -rf var /var/lib/docker
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

安装 yum-utils 包

安装yum-utils包(提供yum-config-manager实用程序)并设置稳定的存储库。

 sudo yum install -y yum-utils
[root@localhost ~]#  sudo yum install -y yum-utils
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
无须任何处理

设置存储库

鉴于国内网络问题,强烈建议使用国内源

sudo yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

官方源

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
[root@localhost ~]# sudo yum-config-manager \
> --add-repo \
> https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, product-id, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://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

安装 docker

安装 docker

sudo yum install docker-ce docker-ce-cli containerd.io
[root@localhost ~]#  yum install docker-ce docker-ce-cli containerd.io
已加载插件:fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 containerd.io.x86_64.0.1.4.9-3.1.el7 将被 安装
---> 软件包 docker-ce.x86_64.3.20.10.7-3.el7 将被 安装
--> 正在处理依赖关系 docker-ce-rootless-extras,它被软件包 3:docker-ce-20.10.7-3.el7.x86_64 需要
---> 软件包 docker-ce-cli.x86_64.1.20.10.7-3.el7 将被 安装
--> 正在处理依赖关系 docker-scan-plugin(x86-64),它被软件包 1:docker-ce-cli-20.10.7-3.el7.x86_64 需要
--> 正在检查事务
---> 软件包 docker-ce-rootless-extras.x86_64.0.20.10.7-3.el7 将被 安装
---> 软件包 docker-scan-plugin.x86_64.0.0.8.0-3.el7 将被 安装
--> 解决依赖关系完成
……省略

启动 docker

 sudo systemctl start docker

查看 docker 状态

 sudo systemctl status docker

测试 docker

通过运行hello world映像验证Docker引擎是否已正确安装。如下说明安装成功

[root@localhost ~]# docker run  hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
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/

开机自启

systemctl enable docker

镜像加速器

请首先执行以下命令,查看是否在 docker.service 文件中配置过镜像地址。

systemctl cat docker | grep '\-\-registry\-mirror'

如果该命令有输出,那么请执行 $ systemctl cat docker 查看 ExecStart= 出现的位置,修改对应的文件内容去掉 --registry-mirror 参数及其值,并按接下来的步骤进行配置。

如果以上命令没有任何输出,那么就可以在 /etc/docker/daemon.json 中写入如下内容(如果文件不存在请新建该文件):

{
"registry-mirrors": [
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com"
]
}

注意,一定要保证该文件符合 json 规范,否则 Docker 将不能启动。

重启 docker 服务

sudo systemctl daemon-reload
sudo systemctl restart docker

参考文档

Docker 官方 CentOS 安装文档

https://yeasy.gitbook.io/docker_practice/install/centos

Docker 安装与卸载的更多相关文章

  1. Docker安装和卸载

    一:卸载旧版本 老版本的Docker被称为docker或docker-engine.如果安装了这些,请卸载它们以及相关的依赖项. $ sudo yum remove docker \ docker-c ...

  2. docker安装与卸载

    文章转自:https://www.cnblogs.com/yufeng218/p/8370670.html  (EE安装) https://blog.csdn.net/jxyzh11/article/ ...

  3. docker 安装 运行 卸载

    一.卸载docker 安装时使用什么工具安装的docker就用什么工具卸载docker: 1.yum卸载docker 查看已安装的docker yum list installed | grep do ...

  4. docker安装及卸载

    docker基本组成 镜像(image): docker镜像好比一个模板,可以通过这个模板创建容器服务,例如:tomcat镜像===>run===>tomcat01容器(提供服务器) 通过 ...

  5. docker学习笔记一-docker安装与卸载

    环境查看 # 1 查询当前centOS的版本,官方要求版本为7以上 uname -r 查询系统内核 cat /etc/os-release 系统版本 安装 # 1.卸载旧版本 yum remove d ...

  6. CentOS7上Docker安装与卸载

    安装 1.安装Docker 参见:https://docs.docker.com/engine/installation/linux/centos/ 2.直接使用root安装(更新系统) yum up ...

  7. Docker 安装、卸载、启动、停止

    1.1 查看当前系统的内核版本 查看当前系统的内核版本是否高于 3.10 英文文档:https://docs.docker.com/ 中文文档:https://docs.docker-cn.com/  ...

  8. Docker基础:VMware虚拟机Centos7环境下docker安装及使用

    1.docker简介 2.docker安装 3.卸载docker 4.阿里云镜像加速 5.docker的常用命令 5.1 帮助命令 5.2 镜像命令 5.3 容器命令 5.4 后台启动命令 5.5 查 ...

  9. Linux环境安装、卸载Docker

    安装: 1.Docker要求CentOS系统的内核版本高于 3.10 ,通过 uname -r 命令查看你当前的内核版本是否支持安账docker 2.更新yum包:sudo yum update 3. ...

随机推荐

  1. 「模拟8.17」star way to heaven(并查集,最小生成树)

    80分打法 首先二分最后答案,答案即为r,可看作以每个k为圆心r为半径的圆 我们进行并查集维护,维护相交的圆的边界 最后判断是否存在圆将上下边界覆盖,如有证明不行 1 #include<iost ...

  2. Mybatis学习01:利用mybatis查询数据库

    通过mybatis来操作mysql数据库的步骤大致可分为以下几步: 在这里,我们以对下面这个这个表格进行操作为例: 表名:ssm 1 配置依赖 在pom.xml中添加所需要的的依赖 <!-- m ...

  3. 一个SQLServer中JSON文档型数据的查询问题

    近日在项目中遇到一个问题: 如何在报表中统计JSON格式存储的数据? 例如有个调查问卷记录表,记录每个问题的答案. 其结构示意如下(横表设计) Id user date Q1_Answer Q2_An ...

  4. 一个排序引发的BUG

    你好呀,我是why. 前两天在 Git 上闲逛的时候又不知不觉逛到 Dubbo 那里去了. 看了一下最近一个月的数据,社区活跃度还是很高的: 然后看了一下最新的 issue,大家提问都很积极. 其中看 ...

  5. 使用阿里云服务器部署jupyter notebook远程访问

    安装annaconda 与jupyter notebook annaconda在已经自带了jupyter notebook.jupyter lab.ipython 等一系列工具,不需要再单独安装这些工 ...

  6. ESCMScript(2)Module语法

    严格模式 ES6 的模块自动采用严格模式,不管你有没有在模块头部加上"use strict";. 严格模式的限制如下 变量必须声明后再使用 函数的参数不能有同名属性,否则报错 不能 ...

  7. python之set集合,基础篇

    集合:set 特点:1>.无序 ,因为集合是无序的,所以不可用下标值查询,也不可切片2>.去重 ,一个集合内不能有两个相同的元素3>.可添加,可删除,不可修改等等4>.集合内的 ...

  8. 获取 Windows 密码「GitHub 热点速览 v.21.28」

    作者:HelloGitHub-小鱼干 安全问题一直是 GitHub 的一大热点,因为数据安全问题诞生的各类自托管服务便是.而本周周榜上的 2 个和安全主题相关的项目,有些不同.mimikatz 是个老 ...

  9. linux sort uniq命令详解

    sort 功能说明:将文本文件内容加以排序,sort可针对文本文件的内容,以行为单位来排序. sort [-bcdfimMnr][-o<输出文件>][-t<分隔字符>][+&l ...

  10. XCTF_Android 黑客精神

    一.概述 这题感觉要懂一些开发的东西才能弄,正向和逆向是永远离不开的 二.先用jeb打开,找到AndroidMainfest这个文件,找到启动的主活动是啥 虽然一般也是就是MainActiivity, ...