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

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

[root@localhost /]# uname -r
3.10.-.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 Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 五 -- :: CST; 3min 57s ago
Docs: http://docs.docker.com
Process: 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=/FAILURE)
Main PID: (code=exited, status=/FAILURE) 4月 :: localhost.localdomain systemd[]: Starting Docker Application Container Engine...
4月 :: localhost.localdomain dockerd-current[]: time="2018-04-20T06:50:50.921964698+08:00" level=warning msg="could not ...ound"
4月 :: localhost.localdomain dockerd-current[]: time="2018-04-20T06:50:50.927241794+08:00" level=info msg="libcontainerd...4010"
4月 :: localhost.localdomain dockerd-current[]: time="2018-04-20T06:50:51.936045098+08:00" level=warning msg="overlay2: the b...
4月 :: localhost.localdomain dockerd-current[]: Error starting daemon: SELinux is not supported with the overlay2 graph ...alse)
4月 :: localhost.localdomain systemd[]: docker.service: main process exited, code=exited, status=/FAILURE
4月 :: localhost.localdomain systemd[]: Failed to start Docker Application Container Engine.
4月 :: localhost.localdomain systemd[]: Unit docker.service entered failed state.
4月 :: localhost.localdomain systemd[]: 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}" ]; then
DOCKER_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:
Running:
Paused:
Stopped:
Images:
Server Version: 1.13.
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: false
Native Overlay Diff: false
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
Volume: local
Network: 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:
seccomp
WARNING: You're not using the default seccomp profile
Profile: /etc/docker/seccomp.json
Kernel Version: 3.10.-.el7.x86_64
Operating System: CentOS Linux (Core)
OSType: linux
Architecture: x86_64
Number of Docker Hooks:
CPUs:
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/
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:latest Hello from Docker!
This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
. 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/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 Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since 五 -- :: CST; 12s ago
Docs: http://docs.docker.com
Main PID: (dockerd-current)
CGroup: /system.slice/docker.service
├─ /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-cu...
└─ /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 Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE. 社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如 ...

  2. docker(一) Centos7下安装docker

    docker(一) Centos7下安装dockerdocker(二) windows10下安装dockerdocker(三) 镜像和容器常用命令 docker(四) 使用Dockerfile构建镜像 ...

  3. CentOS7下安装docker(Docker系列1)

    CentOS7下安装docker 系统要求 为了安装docker,需要准备 64-bit的CentOS 7 删除非官方的Docker包 yum的仓库中有一个很旧的Docker包, 现在Docker官方 ...

  4. centos7上安装docker社区版

    container(容器) docker(集装箱) 容器的优点 1. 启动速度快 2. 节省资源 3. 兼容性高 保证机器正常上网 #ping www.baidu.com CPU需要支持虚拟化 # g ...

  5. centos7下安装docker与镜像加速

    1.背景 centos7下安装docker 2.安装 第一步:检查是否为centos7版本 第二步:依赖环境安装 执行如下两个命令: yum -y install gcc yum -y install ...

  6. centos7.0安装docker报错

    使用centos7.0安装dockers时出现Transaction check error错误. yum install docker Transaction check error: file / ...

  7. Linux(centos7)下安装Docker

    近期公司开始推Docker技术.这个系列的文章都是基于CentOS7系统下进行讲解的. Docker简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器 ...

  8. Centos7快速安装docker

    偶然间发现,docker的安装好容易啊 系统环境:centos7.3 yum源: docker:https://mirrors.aliyun.com/docker-ce/linux/centos/do ...

  9. centos7下安装docker(21docker swarm集群创建)

    创建swarm集群: 实验环境:盗图 swarm-manager是manager node,swarm-worker1和swarm-worker2是worker node. 所有节点的docker版本 ...

  10. centos7下安装docker(14安装docker machine)

    之前我们做的实验都是在一个host上面的,其实在真正的环境中有多个host,容器在这些host上面启动,运行,停止和销毁,相关容器会通过网络相互通信,无论他们是否运行在相同的host上面. 对于这种歌 ...

随机推荐

  1. Android -- 仿小米锁屏画报

    1,首先看一下我们今天实现的效果,效果图如下: 2,首先说一下大体的实现思路,首先这个视图一共分为三层,最外层是一个RecyclerView,第二层是一个被虚化的ImageView,第三层是一个正常的 ...

  2. 记前些日子archlinux更新后无法调节声音的解决方法

    桌面环境用的是xfce4. 自从某次更新过后,panel中调节声音的插件变成了 xfce4-pulseaudio-plugin.然后就发现在panel中无法调节声音了. 在这个插件的属性中发现了一项设 ...

  3. binTreePosterorderTraversal二叉树的后序遍历

    描述: Given a binary tree, return the postorder traversal of its nodes' values. For example: Given bin ...

  4. HDU1007.Quoit Design

    -- 点我 -- 题目大意 :给你一堆点,求一个最小圆能够覆盖两个点的半径(最近两点距离的一半): 最多100000个点,暴力即O(n^2)会超时,考虑二分,先求左边最短距离dl,右边dr, 和一个点 ...

  5. sitecore系统教程之使用修补程序文件自定义Sitecore配置

    您可以使用修补程序文件在Sitecore中添加或更改配置设置.Sitecore将修补程序文件与Sitecore.config 文件合并,以创建在运行时使用的配置文件. 本主题描述: 补丁文件放置 补丁 ...

  6. CSS选择符-----关系选择符

       包含选择符(E F)           选择所有被E元素包含的F元素 与 子选择符(E>F) 不同的是,包含选择符将会命中所有符合条件的后代,包括儿子,孙子,孙子的孙子... <! ...

  7. 设计模式之Interpreter(解释器)(转)

    Interpreter定义: 定义语言的文法 ,并且建立一个解释器来解释该语言中的句子. Interpreter似乎使用面不是很广,它描述了一个语言解释器是如何构成的,在实际应用中,我们可能很少去构造 ...

  8. Linux服务器---流量监控webalizer

    webalize webzlizer是一个免费的web server分析工具,它能够分析apache.ftp等日志,将结果以html形式展示. 1.安装一些依赖软件 [root@localhost b ...

  9. linux的错误码error

    在程序出错时,我们通过全局变量错误号errno和perror函数能够很快的定位到错误原因. Linux错误代码及其含义 C Name Value Description 含义Success 0 Suc ...

  10. vue 加载更多2

    <template lang="html"> <div class="yo-scroll" :class="{'down':(sta ...