在线安装docker

以下操作步骤均在root用户下操作

1、 检查内核是否符合要求

Docker 要求 Centos系统的内核版本高于 3.10 ,建议在Centos 7版本
命令如下:

uname -r

执行过程如下:

[root@localhost yum.repos.d]# uname -r
3.10.0-693.el7.x86_64

2、 配置docker镜像源

命令如下:

wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache

执行过程如下:

[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
--2018-02-09 07:51:02-- https://download.docker.com/linux/centos/docker-ce.repo
正在解析主机 download.docker.com (download.docker.com)... 205.251.203.37, 205.251.203.39, 205.251.203.182, ...
正在连接 download.docker.com (download.docker.com)|205.251.203.37|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2424 (2.4K) [binary/octet-stream]
正在保存至: “/etc/yum.repos.d/docker-ce.repo”
100%[================================================================================>] 2,424 --.-K/s 用时 0s
2018-02-09 07:51:04 (320 MB/s) - 已保存 “/etc/yum.repos.d/docker-ce.repo” [2424/2424])
[root@localhost ~]# yum makecache
已加载插件:fastestmirror, langpacks
base | 3.6 kB 00:00:00
docker-ce-stable | 2.9 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/3): docker-ce-stable/x86_64/primary_db | 11 kB 00:00:01
(2/3): docker-ce-stable/x86_64/filelists_db | 6.5 kB 00:00:01
(3/3): docker-ce-stable/x86_64/other_db | 65 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
元数据缓存已建立

3、 安装docker依赖包

命令如下:

yum remove docker docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2

执行过程如下:

[root@localhost ~]# yum remove docker docker-common docker-selinux docker-engine 删除老版本
已加载插件:fastestmirror, langpacks
参数 docker 没有匹配
参数 docker-common 没有匹配
参数 docker-selinux 没有匹配
参数 docker-engine 没有匹配
不删除任何软件包
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2 安装依赖包
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
。。。。。。
。。。。。。
更新完毕:
device-mapper-persistent-data.x86_64 0:0.7.0-0.1.rc6.el7_4.1
完毕

4、 安装docker-ce

命令如下:

yum install docker-ce

执行过程如下:

[root@localhost ~]# yum install docker-ce
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
base: mirrors.aliyun.com
extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.0.17.12.0.ce-1.el7.centos 将被 安装
--> 正在处理依赖关系 container-selinux >= 2.9,它被软件包 docker-ce-17.12.0.ce-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.36-1.gitff95335.el7 将被 安装
--> 解决依赖关系完成 依赖关系解决 ===============================================================================
Package 架构 版本 源 大小
===============================================================================
正在安装:
docker-ce x86_64 17.12.0.ce-1.el7.centos docker-ce-stable 30 M
为依赖而安装:
container-selinux noarch 2:2.36-1.gitff95335.el7 extras 31 k 事务概要
===============================================================================
安装 1 软件包 (+1 依赖软件包) 总下载量:30 M
安装大小:123 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): container-selinux-2.36-1.gitff95335.el7.noarch.rpm | 31 kB 00:00:01
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm 的公钥尚未安装
(2/2): docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm | 30 MB 00:00:06
----------------------------------------------------------------------------------
总计 4.4 MB/s | 30 MB 00:00:06
https://download.docker.com/linux/centos/gpg 检索密钥
导入 GPG key 0x621E9F35:
用户ID : "Docker Release (CE rpm) docker@docker.com"
指纹 : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
来自 : https://download.docker.com/linux/centos/gpg
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 2:container-selinux-2.36-1.gitff95335.el7.noarch 1/2
正在安装 : docker-ce-17.12.0.ce-1.el7.centos.x86_64 2/2
验证中 : 2:container-selinux-2.36-1.gitff95335.el7.noarch 1/2
验证中 : docker-ce-17.12.0.ce-1.el7.centos.x86_64 2/2
已安装:
docker-ce.x86_64 0:17.12.0.ce-1.el7.centos
作为依赖被安装:
container-selinux.noarch 2:2.36-1.gitff95335.el7
完毕!

5、 启动docker 后台服务

命令如下:

systemctl start docker

执行过程如下:

[root@localhost ~]# systemctl start docker

6、 测试运行hello-world

命令如下:

docker run hello-world

执行过程如下:

[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:66ef312bbac49c39a89aa9bcc3cb4f3c9e7de3788c944158df3ee0176d32b751
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://cloud.docker.com/
    For more examples and ideas, visit:
    https://docs.docker.com/engine/userguide/

Centos 7系统在线安装docker的更多相关文章

  1. CentOS 7.5在线安装Docker 18.09.3

    1.安装依赖包 yum -y install yum-utils device-mapper-persistent-data lvm2 2.安装docker yum-config-manager -- ...

  2. CentOS 通过yum在线安装MySQL5.7

    CentOS 通过yum在线安装MySQL5.7 Step1: 检测系统是否自带安装mysql # yum list installed | grep mysql Step2: 删除系统自带的mysq ...

  3. 在centos和redhat上安装docker

    前置条件 64-bit 系统 kernel 3.10+一.检查内核版本,返回的值大于3.10即可 $ uname -r 二.使用 sudo 或 root 权限的用户登入终端 三.卸载旧版本(如果安装过 ...

  4. CentOS 7.3 上安装docker

    Docker,分为社区版CE和企业版EE.社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务. 一.安装docker 1.Docker 要求 CentOS 系统的内核版本高于 3 ...

  5. 【Docker】在Linux系统中安装Docker虚拟机、启动停止重启查看Docker命令

    安装Docker 文章目录 安装Docker Docker虚拟机架构 在Linux系统中安装Docker虚拟机 管理Docker虚拟机 参考资料 Docker虚拟机架构 Docker创建的所有虚拟实例 ...

  6. CentOS 6系统下安装 JDK1.6

    CentOS 6系统下安装 JDK1.6 JDK(Java Development Kit)是Sun Microsystems针对Java开发员的产品.自从Java推出以来,JDK已经成为使用最广泛的 ...

  7. Linux:CentOS 7系统的安装

    相信有看过我写的博文就知道我写的第一篇博文就是CentOS 7系统的安装,不过是在虚拟机中安装的,而且还是直接加载镜像文件进去的,不过这次我就通过PE来安装,来证实下PE是否可以用来安装Linux系统 ...

  8. centos 在线安装 docker

    镜像下载.域名解析.时间同步请点击 阿里巴巴开源镜像站 在新主机上首次安装Docker Engine之前,需要设置Docker存储库.之后,您可以从存储库安装和更新Docker. 设置存储库 安装yu ...

  9. centos 6.5下安装docker

    关于docker的更多信息,请移步度娘.以下两个链接也对docker有了具体的介绍: http://www.docker.org.cn/book/docker/what-is-docker-16.ht ...

随机推荐

  1. 洛谷P3534 [POI2012] STU

    题目 二分好题 首先用二分找最小的绝对值差,对于每个a[i]都两个方向扫一遍,先都改成差满足的形式,然后再找a[k]等于0的情况,发现如果a[k]要变成0,则从他到左右两个方向上必会有两个连续的区间也 ...

  2. GoCN每日新闻(2019-10-20)

    GoCN每日新闻(2019-10-20) slakc是如何构建共享频道的 https://slack.engineering/how-slack-built-shared-channels-8d42c ...

  3. 当变量超过任意设定的变量限制时终止fluent模拟【翻译】

    一些时候某个特定的变量(压力,速度,温度等)发散会造成不合理的计算结果.在许多算例,当变量超过某些合理的限制时,自动停止/打断模拟是有帮助的. 解决方法是联合UDF和scheme文件.UDF将会遍历所 ...

  4. 《JAVA程序设计》_第十周学习总结

    一.学习内容 12.1进程与进程 程序是一段静态的代码,进程是程序的一次动态执行过程,这个过程也是进程本身从产生.发展至消亡的过程. 线程不是进程,是比进程更小的执行单位.但与进程不同的是,线程的中断 ...

  5. 【转】谈谈servlet、spring、struts

    今年我一直在思考web开发里的前后端分离的问题,到了现在也颇有点心得了,随着这个问题的深入,再加以现在公司很多web项目的控制层的技术框架由struts2迁移到springMVC,我突然有了一个新的疑 ...

  6. 【转】HTTP 协议的历史演变和设计思路

    一.HTTP/0.9 HTTP 是基于 TCP/IP 协议的应用层协议.它不涉及数据包(packet)传输,主要规定了客户端和服务器之间的通信格式,默认使用80端口. 最早版本是1991年发布的0.9 ...

  7. jmeter 参数化大数据取唯一值方式

    jmeter 参数化大数据取唯一值方式 一.用时间函数: 因为时间戳永远没有重复,jmeter参数化,而且要取唯一值,可以考虑用时间函数加上其他函数一起: # 以13位的时间戳作为 userID no ...

  8. 平时常说的ThreadLocal,今天就彻底解决它

    前言 一.了解ThreadLocal的作用 二.ThreadLocal简单使用 三.ThreadLocal原理 3.1 ThreadLocal的存取过程 3.2 探究ThreadLocalMap对象 ...

  9. SQL Server case when 实现分类汇总

    case when 实现分类汇总

  10. Mac下 python2和python3共存

    一般是python2默认安装了,python3没有安装,这时候一般使用命令:brew install python3 进行安装 不同方法安装python的路径是不一样的,如下所示: 接下来就要看具体步 ...