Centos7服务器安装Docker及Docker镜像加速,Docker删除



部分内容原文地址:

CSDN:莫失莫忘c:CentOS 7下安装Docker以及Docker的基本使用



1、Centos7服务器安装Docker

1.1 root账户登录,查看内核版本如下

[root@localhost ~]# uname -a
Linux localhost.qgc 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

1.1.1 卸载服务器旧版本Docker

yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine

1.2 安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: centos.ustc.edu.cn
...

1.3 设置yum源,添加Docker的存储库

[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

1.4 查看所有仓库中所有docker版本,并选择特定版本安装

查看Docker所有版本信息。

[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror, langpacks
可安装的软件包
* updates: centos.ustc.edu.cn
Loading mirror speeds from cached hostfile
* extras: mirrors.aliyun.com
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-ce.x86_64 18.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
...

安装Docker

yum install -y docker-ce

1.5 安装Docker,命令:yum install docker-ce-版本号

[root@localhost ~]# yum install docker-ce-17.12.1.ce
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: centos.ustc.edu.cn
base | 3.6 kB 00:00
docker-ce-stable | 2.9 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.0.17.12.1.ce-1.el7.centos 将被 安装
--> 正在处理依赖关系 container-selinux >= 2.9,它被软件包 docker-ce-17.12.1.ce-1.el7.centos.x86_64 需要
...

1.6 启动Docker,命令:systemctl start docker,然后加入开机启动

[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

1.7 验证安装是否成功(有client和service两部分表示docker安装启动都成功了)

[root@localhost ~]# docker version
Client:
Version: 17.12.1-ce
API version: 1.35
Go version: go1.9.4
Git commit: 7390fc6
Built: Tue Feb 27 22:15:20 2018
OS/Arch: linux/amd64 Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.4
Git commit: 7390fc6
Built: Tue Feb 27 22:17:54 2018
OS/Arch: linux/amd64
Experimental: false

1.8 使用脚本安装Docker

1.8.1 确保yum包是最新版

yum update

1.8.2 执行Docker安装脚本

curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh

2、Docker镜像加速

2.1 修改Docker的配置文件来设置加速地址

vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://br10hqrl.mirror.aliyuncs.com"]
}

如果没有该文件,新建一个。

也可以通过以下命来设置。

tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://br10hqrl.mirror.aliyuncs.com"]
}
EOF

使配置文件生效:

yum remove -y docker-ce
rm -rf /var/lib/docker

3、删除Docker-ce

yum remove -y docker-ce
rm -rf /var/lib/docker

Centos7服务器安装Docker及Docker镜像加速,Docker删除的更多相关文章

  1. Docker 中国官方镜像加速

    参考:https://www.docker-cn.com/registry-mirror 通过 Docker 官方镜像加速,中国区用户能够快速访问最流行的 Docker 镜像.该镜像托管于中国大陆,本 ...

  2. Docker镜像加速 | Docker 中国源 | 仓库

    镜像加速 | Docker 中国https://www.docker-cn.com/registry-mirror

  3. Docker拉取镜像加速

    关于Docker拉取镜像加速 打开桌面 docker 小图标 选中框框 根据下图 添加国内的加速源即可 Docker加速源 #网易 http://hub-mirror.c.163.com #Docke ...

  4. docker如何push镜像到docker hub个人的仓库

    docker如何push镜像到docker hub个人的仓库 step1——找到本地镜像的ID:docker images step2——登陆Hub:docker login --username=u ...

  5. docker 基础之镜像加速

    国内访问 Docker Hub 有时会遇到困难,此时可以配置镜像加速器 对于使用 systemd 的系统,用 systemctl enable docker 启用服务后,编辑 /etc/systemd ...

  6. 使用阿里云对docker拉取镜像加速

    使用docker的时候,总是需要去search镜像,使用国外的源下载太慢,还有诸多的限制,无意中发现可以使用阿里云进行加速,实测有用,废话少说,操作如下: 1.打开阿里云控制台,没有的可以用淘宝账号或 ...

  7. ubuntu 安装 docker 并配置镜像加速(使用 apt-get 进行安装)

    ubuntu 安装docker CentOS docker安装 https://blog.csdn.net/weixin_44953227/article/details/108597310 你需要这 ...

  8. docker hub 国内镜像加速地址

    当前可用 配置文件:vim /etc/docker/daemon.json { "registry-mirrors" : [ "http://docker.mirrors ...

  9. Docker中上传镜像到docker hub中

    原文参考:https://blog.csdn.net/sk_grace/article/details/81220675 申请Docker hub账号首先在https://hub.docker.com ...

  10. docker 通过中间镜像加速部署

    概要 实施 修改前的实施时间 制作编译用的镜像 测试修改后的实施时间 概要 使用 docker 打包镜像的时候, 每次耗费时间最多的就是 docker build 的过程. 特别是对于前端工程的打包, ...

随机推荐

  1. 技术选型关于redis客户端选择

    redis作为分布式缓存框架的首选  相信已经毋庸置疑.能高效.合理的使用好它  必定能提升系统的可用性,高性能.高吞吐量的保障.但选择一个客户端,充分发挥它的能力,就是一个选型问题.现在市场上能选择 ...

  2. 第十七章节 BJROBOT opencv_apps 图像处理示例【ROS全开源阿克曼转向智能网联无人驾驶车】

    1.把小车平放在地板上,用资料里的虚拟机,打开一个终端 ssh 过去主控端启动roslaunch znjrobot camera.launch. 2.在虚拟机端启动 roslaunch opencv_ ...

  3. MobPush厂商通道排查

    开启log 一.添加开启log代码 有AndroidManifest.xml的 //在AndroidManifest.xml的application标签中添加 <meta-data androi ...

  4. .NET 云原生架构师训练营(模块二 基础巩固 MongoDB 聚合)--学习笔记

    2.5.5 MongoDB -- 聚合 排序 索引类型 创建索引 排序 // 升序 db.getCollection('author').find({}).sort({"age": ...

  5. flume的一些使用

    一.第一层采集通道的编写 1.第一层采集脚本Source的选择①Source: 数据源在日志文件中! 读取日志中的数据,可以使用以下Source ExecSource: 可以执行一个linux命令,例 ...

  6. 【递归】P1706全排列问题

    题目相关 题目描述 输出自然数 1 到 n所有不重复的排列,即 n的全排列,要求所产生的任一数字序列中不允许出现重复的数字. 输入格式 一个整数 n**. 输出格式 由 1∼n 组成的所有不重复的数字 ...

  7. LeetCode53 最大子序列问题

    题目描述: 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和.     示例:     输入: [-2,1,-3,4,-1,2,1,-5,4],   ...

  8. python学习笔记 | strftime()格式化输出时间

    time模块 import time t = time.strftime("%Y-%m-%d %H:%M:%S") print(t) datetime模块 import datet ...

  9. g/test/s/lose/won/g

    包含字符串test的任意行商,用lose代替won

  10. 【Oracle】Script to Collect DRM Information (drmdiag.sql) (文档 ID 1492990.1)

    脚本对应如下: The following (drmdiag.sql) is a script to collect information related to DRM (Dyanamic Reso ...