centos 在线安装 docker
镜像下载、域名解析、时间同步请点击 阿里巴巴开源镜像站
在新主机上首次安装Docker Engine之前,需要设置Docker存储库。之后,您可以从存储库安装和更新Docker。
设置存储库
安装yum-utils软件包(提供yum-config-manager 实用程序)并设置稳定的存储库。
[root@localhost ~]# yum install -y yum-utils
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 yum-utils.noarch.0.1.1.31-24.el7 将被 升级
---> 软件包 yum-utils.noarch.0.1.1.31-52.el7 将被 更新
--> 正在处理依赖关系 yum >= 3.4.3-143,它被软件包 yum-utils-1.1.31-52.el7.noarch 需要
--> 正在检查事务
---> 软件包 yum.noarch.0.3.4.3-118.el7.centos 将被 升级
---> 软件包 yum.noarch.0.3.4.3-163.el7.centos 将被 更新
--> 正在处理依赖关系 rpm >= 4.11.3-22,它被软件包 yum-3.4.3-163.el7.centos.noarch 需要
--> 正在处理依赖关系 python-urlgrabber >= 3.10-8,它被软件包 yum-3.4.3-163.el7.centos.noarch 需要
--> 正在检查事务
---> 软件包 python-urlgrabber.noarch.0.3.10-4.el7 将被 升级
---> 软件包 python-urlgrabber.noarch.0.3.10-9.el7 将被 更新
---> 软件包 rpm.x86_64.0.4.11.1-16.el7 将被 升级
--> 正在处理依赖关系 rpm = 4.11.1-16.el7,它被软件包 rpm-python-4.11.1-16.el7.x86_64 需要
--> 正在处理依赖关系 rpm = 4.11.1-16.el7,它被软件包 rpm-libs-4.11.1-16.el7.x86_64 需要
---> 软件包 rpm.x86_64.0.4.11.3-40.el7 将被 更新
--> 正在检查事务
---> 软件包 rpm-libs.x86_64.0.4.11.1-16.el7 将被 升级
--> 正在处理依赖关系 rpm-libs(x86-64) = 4.11.1-16.el7,它被软件包 rpm-build-libs-4.11.1-16.el7.x86_64 需要
---> 软件包 rpm-libs.x86_64.0.4.11.3-40.el7 将被 更新
---> 软件包 rpm-python.x86_64.0.4.11.1-16.el7 将被 升级
---> 软件包 rpm-python.x86_64.0.4.11.3-40.el7 将被 更新
--> 正在检查事务
---> 软件包 rpm-build-libs.x86_64.0.4.11.1-16.el7 将被 升级
---> 软件包 rpm-build-libs.x86_64.0.4.11.3-40.el7 将被 更新
--> 解决依赖关系完成
依赖关系解决
============================================================================================================================================================================================================================
Package 架构 版本 源 大小
============================================================================================================================================================================================================================
正在更新:
yum-utils noarch 1.1.31-52.el7 base 121 k
为依赖而更新:
python-urlgrabber noarch 3.10-9.el7 base 108 k
rpm x86_64 4.11.3-40.el7 base 1.2 M
rpm-build-libs x86_64 4.11.3-40.el7 base 107 k
rpm-libs x86_64 4.11.3-40.el7 base 278 k
rpm-python x86_64 4.11.3-40.el7 base 83 k
yum noarch 3.4.3-163.el7.centos base 1.2 M
事务概要
============================================================================================================================================================================================================================
升级 1 软件包 (+6 依赖软件包)
总计:3.1 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : rpm-libs-4.11.3-40.el7.x86_64 1/14
正在更新 : rpm-4.11.3-40.el7.x86_64 2/14
正在更新 : rpm-build-libs-4.11.3-40.el7.x86_64 3/14
正在更新 : rpm-python-4.11.3-40.el7.x86_64 4/14
正在更新 : python-urlgrabber-3.10-9.el7.noarch 5/14
正在更新 : yum-3.4.3-163.el7.centos.noarch 6/14
正在更新 : yum-utils-1.1.31-52.el7.noarch 7/14
清理 : yum-utils-1.1.31-24.el7.noarch 8/14
清理 : yum-3.4.3-118.el7.centos.noarch 9/14
清理 : rpm-python-4.11.1-16.el7.x86_64 10/14
清理 : python-urlgrabber-3.10-4.el7.noarch 11/14
清理 : rpm-build-libs-4.11.1-16.el7.x86_64 12/14
清理 : rpm-libs-4.11.1-16.el7.x86_64 13/14
清理 : rpm-4.11.1-16.el7.x86_64 14/14
验证中 : python-urlgrabber-3.10-9.el7.noarch 1/14
验证中 : rpm-python-4.11.3-40.el7.x86_64 2/14
验证中 : yum-utils-1.1.31-52.el7.noarch 3/14
验证中 : rpm-4.11.3-40.el7.x86_64 4/14
验证中 : yum-3.4.3-163.el7.centos.noarch 5/14
验证中 : rpm-libs-4.11.3-40.el7.x86_64 6/14
验证中 : rpm-build-libs-4.11.3-40.el7.x86_64 7/14
验证中 : python-urlgrabber-3.10-4.el7.noarch 8/14
验证中 : rpm-python-4.11.1-16.el7.x86_64 9/14
验证中 : rpm-build-libs-4.11.1-16.el7.x86_64 10/14
验证中 : rpm-libs-4.11.1-16.el7.x86_64 11/14
验证中 : yum-utils-1.1.31-24.el7.noarch 12/14
验证中 : yum-3.4.3-118.el7.centos.noarch 13/14
验证中 : rpm-4.11.1-16.el7.x86_64 14/14
更新完毕:
yum-utils.noarch 0:1.1.31-52.el7
作为依赖被升级:
python-urlgrabber.noarch 0:3.10-9.el7 rpm.x86_64 0:4.11.3-40.el7 rpm-build-libs.x86_64 0:4.11.3-40.el7 rpm-libs.x86_64 0:4.11.3-40.el7 rpm-python.x86_64 0:4.11.3-40.el7 yum.noarch 0:3.4.3-163.el7.centos
完毕!
添加下载地址:
yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
安装DOCKER引擎
安装最新版本的Docker Engine和容器,或转到下一步以安装特定版本: 过程比较漫长 等等就好
yum install docker-ce docker-ce-cli containerd.io
如果提示您接受GPG密钥,请验证指纹是否匹配 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35,如果是,则接受它。
不出意外 你会看到 成功两个字 ,
启动Docker。 systemctl start docker
别急 如果启动失败了 说明 版本问题导致的
你可以先卸载 再 继续安装 ,当然是选择性安装 根据版本号安装
要安装特定版本的Docker Engine,请在存储库中列出可用版本,然后选择并安装:
一个。列出并排序您存储库中可用的版本。此示例按版本号(从高到低)对结果进行排序,
[root@localhost lib]# yum list docker-ce --showduplicates | sort -r
已加载插件:fastestmirror, langpacks
可安装的软件包
* updates: mirrors.aliyun.com
Loading mirror speeds from cached hostfile
* extras: mirrors.aliyun.com
docker-ce.x86_64 3:19.03.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:19.03.0-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.9-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.8-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.7-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.5-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.4-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.3-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.2-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.3.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.2.ce-3.el7 docker-ce-stable
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-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.3.ce-1.el7 docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
返回的列表取决于启用了哪些存储库,并且特定于您的CentOS版本(.el7在本示例中以后缀表示)。
b。通过其完全合格的软件包名称安装特定版本,该软件包名称是软件包名称(docker-ce)加上版本字符串(第二列),从第一个冒号(:)一直到第一个连字符,并用连字符(-)分隔。例如,docker-ce-18.09.1。
yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
首先卸载之前的安装 (当然你也可以选择升级linux内核)
yum remove docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
执行完成后继续下面的执行
自定义安装
[root@localhost ~]# yum install docker-ce-17.09.1.ce
BDB2053 Freeing read locks for locker 0x72a: 51685/139945979692864
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.0.17.09.1.ce-1.el7.centos 将被 安装
--> 解决依赖关系完成
依赖关系解决
=============================================================================================================================================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================================================================================================================================
正在安装:
docker-ce x86_64 17.09.1.ce-1.el7.centos docker-ce-stable 21 M
事务概要
=============================================================================================================================================================================================================================================================================
安装 1 软件包
总下载量:21 M
安装大小:21 M
Is this ok [y/d/N]: y
Downloading packages:
docker-ce-17.09.1.ce-1.el7.cen FAILED 91% [==================================================================================================== ] 1.2 B/s | 19 MB 433:07:05 ETA
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.09.1.ce-1.el7.centos.x86_64.rpm: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.09.1.ce-1.el7.centos.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
docker-ce-17.09.1.ce-1.el7.centos.x86_64.rpm | 21 MB 00:00:56
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : docker-ce-17.09.1.ce-1.el7.centos.x86_64 1/1
验证中 : docker-ce-17.09.1.ce-1.el7.centos.x86_64 1/1
已安装:
docker-ce.x86_64 0:17.09.1.ce-1.el7.centos
完毕!
[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since 二 2020-04-07 21:52:23 CST; 41min ago
Docs: https://docs.docker.com
Main PID: 51154 (code=exited, status=1/FAILURE)
4月 07 21:52:21 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
4月 07 21:52:21 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
4月 07 21:52:21 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
4月 07 21:52:21 localhost.localdomain systemd[1]: docker.service failed.
4月 07 21:52:23 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
4月 07 21:52:23 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
4月 07 21:52:23 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
4月 07 21:52:23 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
4月 07 21:52:23 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
4月 07 21:52:23 localhost.localdomain systemd[1]: docker.service failed.
[root@localhost ~]# systemctl start docker.service
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since 二 2020-04-07 22:33:51 CST; 8s ago
Docs: https://docs.docker.com
Main PID: 53799 (dockerd)
Memory: 14.7M
CGroup: /system.slice/docker.service
├─53799 /usr/bin/dockerd
└─53805 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
4月 07 22:33:50 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:50.384733771+08:00" level=info msg="devmapper: Successfully created filesystem xfs on device docker-253:1-2180700-base"
4月 07 22:33:50 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:50.460507062+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
4月 07 22:33:50 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:50.460884311+08:00" level=warning msg="mountpoint for pids not found"
4月 07 22:33:50 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:50.461183759+08:00" level=info msg="Loading containers: start."
4月 07 22:33:50 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:50.901283597+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
4月 07 22:33:51 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:51.123313352+08:00" level=info msg="Loading containers: done."
4月 07 22:33:51 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:51.140985188+08:00" level=info msg="Docker daemon" commit=19e2cf6 graphdriver(s)=devicemapper version=17.09.1-ce
4月 07 22:33:51 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:51.141114485+08:00" level=info msg="Daemon has completed initialization"
4月 07 22:33:51 localhost.localdomain dockerd[53799]: time="2020-04-07T22:33:51.164127752+08:00" level=info msg="API listen on /var/run/docker.sock"
4月 07 22:33:51 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
然后运行示例程序 在这之前 需要引入国内的镜像地址 当然你有FQ 可以不要的
通过运行hello-world 映像来验证是否正确安装了Docker Engine 。
docker run hello-world
配置
/etc/docker 目录下创建 daemon.json
[root@localhost docker]# ll
总用量 8
-rw-r--r-- 1 root root 65 4月 7 22:50 daemon.json
-rw------- 1 root root 244 4月 7 22:33 key.json
然后里面的内容为
{ "registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com"] }
保存后 执行 测试命令
[root@localhost docker]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
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/
[root@localhost docker]# docker run hello-world
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/
[root@localhost docker]#
本文转自:
https://blog.51cto.com/u_15446828/4775102
centos 在线安装 docker的更多相关文章
- Centos 7系统在线安装docker
在线安装docker 以下操作步骤均在root用户下操作 1. 检查内核是否符合要求 Docker 要求 Centos系统的内核版本高于 3.10 ,建议在Centos 7版本命令如下: uname ...
- CentOS 7 安装 Docker
CentOS 7 安装 Docker 这里介绍 ContOS 7 的安装 docker V1.2+,包括阿里云加速 docker 镜像下载的设置,这对提升使用 docker 体验至关重要.其他系统安装 ...
- centos在线安装svn
centos在线安装svn 用下列命令安装svn服务 yum install subversion 创建svn版本库目录 mkdir -p /var/svn/svnrepos 创建版本库 svnadm ...
- 在RedHat/CentOS下安装Docker(不升级内核)
由于内核版本问题,最初仅Ubuntu可以较好的支持Docker.不过,由于RedHat系列OS(REHL.CentOS)是目前主流的Linux服务器操作系统,所以令RedHat系列OS支持Docker ...
- 简单介绍一下在CentOS上安装Docker。
简单介绍一下在CentOS上安装Docker. 前置条件: 64-bit 系统 kernel 3.10+ 1.检查内核版本,返回的值大于3.10即可. $ uname -r 2.使用 sudo 或 r ...
- Centos 下面安装 docker
试过了虚拟机VM ,今天尝试在虚拟机centos 中安装 docker ,入门是看的阮一峰的http://www.ruanyifeng.com/blog/2018/02/docker-tutorial ...
- docker学习之路-centos下安装docker
前言 我要在云服务器上做一个asp.net core的webapi应用,使用docker来部署应用,中间用到的任何组件包括nginx和sqlserver 2017都是用docker来装载运行,所以,这 ...
- Centos 在线安装 nginx
centos 在线安装 nginx 安装nginx 参考文档: http://nginx.org/en/linux_packages.html 中的RHEL/CentOS章节,按照步骤安装repo ...
- Centos下安装Docker,并配置国内docker源
Centos下安装Docker 替换为国内的yum源(可选): mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.re ...
随机推荐
- pytorch学习
1 torch.hub torch.hub是一个包含计算机视觉和自然语言处理领域的诸多经典模型调用中心API 我没有运行成功代码 https://blog.csdn.net/qq_38410428/a ...
- 谷粒商城Day1
环境搭建 安装JDK1.8: 1 下载并解压jdk1.8 tar -zxvf jdk-8u281-linux-x64.tar.gz(检查本机有没有jdk有的话卸载掉.安装上自己的jdk) 2 配上环境 ...
- Pandas常用操作 - 去重
1. 使用 drop_duplicates 去重 1.1 初始化数据 df = pd.DataFrame({'stu_name': ['Tom', 'Tony', 'Jack', 'Jack', np ...
- C语言中各种输入函数之间的区别
以下内容全部来自Bay(百度百科) scanf的返回值 scanf()函数返回成功赋值的数据项数,读到文件末尾出错时则返回EOF. 如: scanf("%d%d", &a, ...
- Linux基础:子网划分
一.ip地址基本知识 1.1 ip地址的结构和分类 1.2 特殊ip地址 1.3 子网掩码 1.4 ip地址申请 二.子网划分 2.1 子网划分概念 2.2 c类子网划分初探 2.3 子网划分步骤 2 ...
- Solution -「多校联训」排水系统
\(\mathcal{Description}\) Link. 在 NOIP 2020 A 的基础上,每条边赋权值 \(a_i\),随机恰好一条边断掉,第 \(i\) 条段的概率正比于 \(a ...
- Solution -「洛谷 P5827」边双连通图计数
\(\mathcal{Description}\) link. 求包含 \(n\) 个点的边双连通图的个数. \(n\le10^5\). \(\mathcal{Solution}\) ...
- Note -「计算几何」模板
尚未完整测试,务必留意模板 bug! /* Clearink */ #include <cmath> #include <queue> #include <cstdi ...
- 实战 | 关于随手一点就发现XSS漏洞这件事
起因 今天正在做一个项目时,需要找一个云接码平台接码去登录系统.当我随手从百度找了一个接码平台时,一个偶然的发现,有了今天这篇文章. 正文 当我进入这个接码平台随便找了个手机号,然后等了好几分钟都没啥 ...
- mysql 事务 隔离性 锁
1.四大特性 1.1 原子性(Atomicity) 一个事务是不可分割的最小工作单位.一个事务是不可分割的最小工作单位. 利用undo log保证原子性,undo log记录的是操作的反向语句,例如执 ...