Docker 安装与卸载
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
镜像加速器
- 阿里云加速器(点击管理控制台 -> 登录账号(淘宝账号) -> 右侧镜像工具 -> 镜像加速器 -> 复制加速器地址)
- 网易云加速器
https://hub-mirror.c.163.com - 百度云加速器
https://mirror.baidubce.com - 中国科技大学 https://docker.mirrors.ustc.edu.cn
- ustc https://docker.mirrors.ustc.edu.cn
- Docker中国区官方镜像 https://registry.docker-cn.com
请首先执行以下命令,查看是否在
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
参考文档
https://yeasy.gitbook.io/docker_practice/install/centos
Docker 安装与卸载的更多相关文章
- Docker安装和卸载
一:卸载旧版本 老版本的Docker被称为docker或docker-engine.如果安装了这些,请卸载它们以及相关的依赖项. $ sudo yum remove docker \ docker-c ...
- docker安装与卸载
文章转自:https://www.cnblogs.com/yufeng218/p/8370670.html (EE安装) https://blog.csdn.net/jxyzh11/article/ ...
- docker 安装 运行 卸载
一.卸载docker 安装时使用什么工具安装的docker就用什么工具卸载docker: 1.yum卸载docker 查看已安装的docker yum list installed | grep do ...
- docker安装及卸载
docker基本组成 镜像(image): docker镜像好比一个模板,可以通过这个模板创建容器服务,例如:tomcat镜像===>run===>tomcat01容器(提供服务器) 通过 ...
- docker学习笔记一-docker安装与卸载
环境查看 # 1 查询当前centOS的版本,官方要求版本为7以上 uname -r 查询系统内核 cat /etc/os-release 系统版本 安装 # 1.卸载旧版本 yum remove d ...
- CentOS7上Docker安装与卸载
安装 1.安装Docker 参见:https://docs.docker.com/engine/installation/linux/centos/ 2.直接使用root安装(更新系统) yum up ...
- Docker 安装、卸载、启动、停止
1.1 查看当前系统的内核版本 查看当前系统的内核版本是否高于 3.10 英文文档:https://docs.docker.com/ 中文文档:https://docs.docker-cn.com/ ...
- Docker基础:VMware虚拟机Centos7环境下docker安装及使用
1.docker简介 2.docker安装 3.卸载docker 4.阿里云镜像加速 5.docker的常用命令 5.1 帮助命令 5.2 镜像命令 5.3 容器命令 5.4 后台启动命令 5.5 查 ...
- Linux环境安装、卸载Docker
安装: 1.Docker要求CentOS系统的内核版本高于 3.10 ,通过 uname -r 命令查看你当前的内核版本是否支持安账docker 2.更新yum包:sudo yum update 3. ...
随机推荐
- 海康威视ISC平台的VUE二次开发接入实现
第一步 取得ISC平台的appkey以及secret,以及安装ISC平台的主机IP,这一步至关重要!!! 第二步 由于目前我所在的公司项目前端的代码均由vue所实现,所以利用vue-cli创建一个最简 ...
- Html中的canvas
使用cancas完成袋鼠跳跃的界面,这个是怎么做得呀,我哭了呀
- vue中$nextTick详细讲解保证你一看就明白
1.功能描述 今天我们要实现这个一个小功能: 页面渲染完成后展示一个div元素: 当点击这个div元素后: div元素消失: 出现一个input元素:并且input元素聚焦 想必大家我觉得简单,我们一 ...
- Python的字符串和编码
1. 字符编码 字符串也是一种数据类型,但是,字符串比较特殊的是还有一个编码问题. 因为计算机只能处理数字,如果要处理文本,就必须先把文本转换为数字才能处理.最早的计算机在设计时采用8个比特(bit) ...
- 最强阿里巴巴历年经典面试题汇总:C++研发岗
(1).B树.存储模型 (2).字典树构造及其优化与应用 (3).持久化数据结构,序列化与反序列化时机(4).在无序数组中找最大的K个数? (4).大规模文本文件,全是单词,求前10词频的单词 (5) ...
- Harbor镜像仓库
Harbor镜像仓库 作者 刘畅 时间 2020-7-11 微信 目录 1.下载离线安装包 1 2.安装docker 1 3.安装docker-compose 2 4.自签TLS证书 2 4.1.创建 ...
- 集合类线程安全吗?ConcurrentModification异常遇到过吗?如何解决?
集合类不安全的问题 1. ArrayList的线程不安全问题 1.1 首先回顾ArrayList底层 ArrayList的底层数据结构是数组 底层是一个Object[] elementData的数组, ...
- iOS工程师如何恍然大悟?
聊聊行情?为什么总有人在乎旁人的看法而忽略自己的初衷? 虽然iOS开发市场说不上好但也绝不算坏,想没想过那些煽风点火说iOS不行的人在做什么? 真的转行从头开始? 错.大错特错! 在劝退你的同时他们会 ...
- Gym 101334J 找规律
题意: 给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + - + k mod n的值,其中k mod i表示k除以i的余数.例如j(5, 3)=3 mo ...
- Linux系统inodes资源耗尽时的查找及删除
for i in {1..10}; do echo $i; ls > $i.log; done for i in $(seq 1 10); do echo $i; done 以上为for循环的使 ...