Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。

通过 uname -r 命令查看你当前的内核版本

[root@localhost /]# uname -r
3.10.0-327.el7.x86_64

Docker 软件包和依赖包已经包含在默认的 CentOS-Extras 软件源里,安装命令如下:

yum -y install docker

启动docker:

[root@localhost /]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

查看具体错误信息:

[root@localhost /]# systemctl status docker.service
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)Active: failed (Result: exit-code) since 五 2018-04-20 06:50:52 CST; 3min 57s agoDocs: http://docs.docker.comProcess: 44005 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)Main PID: 44005 (code=exited, status=1/FAILURE)4月 20 06:50:50 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
4月 20 06:50:50 localhost.localdomain dockerd-current[44005]: time="2018-04-20T06:50:50.921964698+08:00" level=warning msg="could not ...ound"
4月 20 06:50:50 localhost.localdomain dockerd-current[44005]: time="2018-04-20T06:50:50.927241794+08:00" level=info msg="libcontainerd...4010"
4月 20 06:50:51 localhost.localdomain dockerd-current[44005]: time="2018-04-20T06:50:51.936045098+08:00" level=warning msg="overlay2: the b...
4月 20 06:50:52 localhost.localdomain dockerd-current[44005]: Error starting daemon: SELinux is not supported with the overlay2 graph ...alse)
4月 20 06:50:52 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
4月 20 06:50:52 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
4月 20 06:50:52 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
4月 20 06:50:52 localhost.localdomain systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

可以看出错误信息

Error starting daemon: SELinux is not supported with the overlay2 graph ...alse)此linux的内核中的SELinux不支持 overlay2 graph driver ,解决方法有两个,要么启动一个新内核,要么就在docker里禁用selinux,--selinux-enabled=false
[root@localhost /]# vi /etc/sysconfig/docker

修改配置:

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; thenDOCKER_CERT_PATH=/etc/docker
fi# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# from the atomic-registries package.
#

在--selinux-enabled后面添加=false即可!

重新启动docker

[root@localhost /]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@localhost /]# docker info
Containers: 0Running: 0Paused: 0Stopped: 0
Images: 0
Server Version: 1.13.1
Storage Driver: overlay2Backing Filesystem: xfsSupports d_type: falseNative Overlay Diff: false
Logging Driver: journald
Cgroup Driver: systemd
Plugins: Volume: localNetwork: bridge host macvlan null overlay
Swarm: inactive
Runtimes: docker-runc runc
Default Runtime: docker-runc
Init Binary: docker-init
containerd version:  (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
runc version: N/A (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:seccompWARNING: You're not using the default seccomp profileProfile: /etc/docker/seccomp.json
Kernel Version: 3.10.0-327.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 1
Total Memory: 977.9 MiB
Name: localhost.localdomain
ID: 2QP3:PYDM:BLLS:P5QS:QGJN:N7GK:DAKV:ZWFG:FW54:FHS4:FCAN:6NR4
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Experimental: false
Insecure Registries:127.0.0.0/8
Live Restore Enabled: false
Registries: docker.io (secure)

测试运行hello-world

[root@localhost /]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
/usr/bin/docker-current: Get https://registry-1.docker.io/v2/library/hello-world/manifests/sha256:d5c74e6f8efc7bdf42a5e22bd764400692cf82360d86b8c587a7584b03f51520: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: net/http: request canceled (Client.Timeout exceeded while awaiting headers).
See '/usr/bin/docker-current run --help'.
[root@localhost /]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
9bb5a5d4561a: Pull complete
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for docker.io/hello-world:latestHello 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 theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/

For more examples and ideas, visit:https://docs.docker.com/engine/userguide/

启动重启命令:

[hongdada@localhost home]$ systemctl stop docker.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password:
==== AUTHENTICATION COMPLETE ===
[hongdada@localhost home]$ systemctl restart docker.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password:
==== AUTHENTICATION COMPLETE ===
[hongdada@localhost home]$ systemctl status docker.service
● docker.service - Docker Application Container EngineLoaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)Active: active (running) since 五 2018-04-20 08:11:34 CST; 12s agoDocs: http://docs.docker.comMain PID: 51878 (dockerd-current)CGroup: /system.slice/docker.service├─51878 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-cu...└─51883 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-con...

http://www.runoob.com/docker/centos-docker-install.html

https://www.cnblogs.com/amoyzhu/p/5261393.html

https://blog.csdn.net/11b202/article/details/21389067

http://www.21yunwei.com/archives/4437

CentOS7.2 安装Docker相关推荐

  1. Centos7下安装Docker

    Centos7下安装Docker(详细的新手装逼教程) 参考: https://www.cnblogs.com/qgc1995/archive/2018/08/29/9553572.html 早就听说 ...

  2. centos7.4安装docker

    文章目录 前言 安装docker 1. 前置准备[关闭防火墙等] 2. 卸载旧版本 3. 安装必备软件包 4. 设置yum源 5. 安装[yum方式] 6. 启动 7. 验证 安装docker-com ...

  3. centos7.7安装docker

    centos7.7安装docker 检查内核版本 Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10 uname -r 更新yum包 yum -y update ...

  4. Centos7/8安装docker

    Centos7/8安装docker docker环境安装 安装yum-utils,包含yum-config-manager用于设置仓库 sudo yum install -y yum-utils 设置 ...

  5. centos7下安装docker(14安装docker machine​)

    为所有host安装和配置docker 之前我们手工安装了一个docker host: 1.安装https CA证书 2.添加GPG key 3.添加docker apt源 4.安装docker     ...

  6. Centos7下安装Docker(详细安装教程、傻瓜式安装)

    一,Docker简介 百科说:Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙 ...

  7. Linux Centos7 离线安装docker 【官网翻译和注释】

    Centos7的Docker安装 需要一个维护版本的centos7,所以6不行. 卸载旧版本 旧版本的docker被称为 docker or docker-engine 如果存在请删除它们. sudo ...

  8. KSO-docker命令大全,基于Linux服务器CentOS7.5 安装docker

    1 docker简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux或Windows操作系统的机器上,也可以实现虚拟化 ...

  9. CentOS7 下安装docker

    安装必要条件: 操作系统: centos7 卸载旧版本: ```yum remove docker \                  docker-common \                 ...

  10. Centos7下安装Docker(详细的新手装逼教程)

    早就听说过Docker,一直不清楚是个啥,今天捣鼓了一下,这里做个记录. --------------------------------------------------------------- ...

最新文章

  1. 打造计数君!谷歌提出RepNet:可自动计数视频重复片段 | CVPR 2020
  2. K-近邻算法之kd树
  3. oracle sql判断值为空,Oracle,sqlserver的空值(null)判断
  4. Windoes上安装(升级)虚拟化VMware Workstattion Pro软件、序列码激活软件
  5. xpath如何得到【爬虫】
  6. FPGA与MCU,DSP(如C6000,C5000等)等设计思想的异同
  7. Quartz 的SB问题 GetNextValidTimeAfter 输出和输出 时区 不同步,好傻的方法?
  8. fedora 27 mysql_无法在Fedora27上的Python2 virtualenv中使用mysqldb
  9. css如何让背景透明,文字不透明
  10. mysql5.6 慢查询_MySQL5.6 如何优化慢查询的SQL语句
  11. weka特征选择源码阅读
  12. 基于Web的SQL Server管理工具(SQL Server Web Tools )
  13. Cat8八类网线是什么?与Cat5、Cat6、Cat7网线的区别?
  14. 常见计算机录制屏幕软件名称,录制电脑屏幕视频的软件有什么?
  15. Arduino Nano开发板设备描述符无法识别等问题汇总
  16. 【华为MateBook13】更换1TB固态硬盘SSD+重装win10系统+安装NVIDIA显卡驱动+电脑管家+指纹驱动+蓝牙驱动+Office激活
  17. maven 入门(转)
  18. 阿里云Redis开发规范学习总结
  19. Flash分模块开发,Flash分模块加载,以及使用Flex经行游戏开发!
  20. 关于shell命令中 prog=${0##*/}

热门文章

  1. PHP 打印调用堆栈信息
  2. 【RPC服务器不可用】解决方法
  3. 6425C-Lab6 实现组策略
  4. android 中文件操作模式
  5. Cisco 3640策略路由配置
  6. k8s集群配置使用coredns代替kube-dns
  7. 安全多方计算(MPC)从入门到精通:JUGO-IDE及SDK
  8. 遭遇错误:ORA-01031
  9. C# 如何以参数的形式调用.exe程序
  10. Linux下wine用法