1、安装并启动docker

1、检查内核版本,必须是3.10及以上
uname -r
2、安装docker

yum install docker命令安装(需要联网)

 [root@localhost ~]# yum install docker
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 156 kB 00:00:00
(2/4): updates/7/x86_64/primary_db | 1.3 MB 00:00:00
(3/4): base/7/x86_64/group_gz | 166 kB 00:00:00
(4/4): base/7/x86_64/primary_db | 6.0 MB 00:00:01
Determining fastest mirrors
* base: centos.ustc.edu.cn
* extras: mirrors.163.com
* updates: centos.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.13.1-88.git07f3374.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.13.1-88.git07f3374.el7.centos for package: 2:docker-1.13.1-88.git07f3374.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.13.1-88.git07f3374.el7.centos for package: 2:docker-1.13.1-88.git07f3374.el7.centos.x86_64
...
Install 1 Package (+27 Dependent packages)
Upgrade 1 Package (+15 Dependent packages) Total download size: 41 M 询问是否下载安装,输入y
Is this ok [y/d/N]: y
进入下载安装过程...
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64/7/extras/packages/atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYs | 0 B --:--:-- ETA
Public key for atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64.rpm is not installed
(1/44): atomic-registries-1.22.1-26.gitb507039.el7.centos.x86_64.rpm | 35 kB 00:00:00
Public key for PyYAML-3.10-11.el7.x86_64.rpm is not installed
(2/44): PyYAML-3.10-11.el7.x86_64.rpm | 153 kB 00:00:00
(3/44): audit-2.8.4-4.el7.x86_64.rpm | 250 kB 00:00:00
...
(44/44): systemd-sysv-219-62.el7.x86_64.rpm | 83 kB 00:00:01
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total
安装完成后可能出现下面内容(大致是从文件中检索秘钥,询问是否导入秘钥),输入y即可
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-2.1511.el7.centos.2.10.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y

3、输入y确认安装
4、启动docker

  启动docker
1 [root@localhost ~]# systemctl start docker
  查看docker版本
[root@localhost ~]# docker -v
  Docker version 1.12.6, build 3e8e77d/1.12.6

2.可能出现的错误

错误1:

  启动时提示报错

    Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

  根据提示查看 systemctl status docker.service,看到错误信息如下

    Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a ne...led=false)

 [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 Sat 2018-12-29 02:40:04 EST; 2min 11s ago
Docs: http://docs.docker.com
Process: 4936 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 --init-path=/usr/libexec/docker/docker-init-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: 4936 (code=exited, status=1/FAILURE)
CGroup: /system.slice/docker.service Dec 29 02:40:02 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Dec 29 02:40:02 localhost.localdomain dockerd-current[4936]: time="2018-12-29T02:40:02.948680364-05:00" level=warning msg="could not change group /var/run/docker.sock to docker:...not found"
Dec 29 02:40:02 localhost.localdomain dockerd-current[4936]: time="2018-12-29T02:40:02.956633687-05:00" level=info msg="libcontainerd: new containerd process, pid: 4940"
Dec 29 02:40:03 localhost.localdomain dockerd-current[4936]: time="2018-12-29T02:40:03.969576324-05:00" level=warning msg="overlay2: the backing xfs filesystem is formatted without d_type...
Dec 29 02:40:04 localhost.localdomain dockerd-current[4936]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a ne...led=false)
Dec 29 02:40:04 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 29 02:40:04 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Dec 29 02:40:04 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Dec 29 02:40:04 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 driver on this kernel. Either boot into a ne...led=false)
 

解决方案

重新编辑/etc/sysconfig/docker(docker配置文件)

 [root@localhost ~]# vi /etc/sysconfig/docker
# /etc/sysconfig/docker # Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --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
# instead. For more information reference the registries.conf(5) man page. # Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp # Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below. 将上面的
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
修改为
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'

然后退出vi编辑(按Esc键,输入:wq,按Enter)

输入systemctl restart docker命令重启docker服务

liunx下安装Docker的更多相关文章

  1. Redhat/Ubuntu/Windows下安装Docker

    Redhat/Ubuntu/Windows下安装Docker 什么是Docker Docker是Docker.inc公司开源的一个基于LXC技术之上构建的Container容器引擎,基于Go语言并遵从 ...

  2. Liunx下安装jdk

    Liunx下安装jdk 1.首先进入ROOT权限  命令 sudo su  输入密码进入 root 权限 2.看下当前liunx 是否存在jdk 环境 ,输入命令 javac,如果存在则会显示对应jd ...

  3. centos 6.5下安装docker

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

  4. 在Ubuntu14.04下安装Docker CE(1) - repository篇

    从2017年3月开始,Docker开始分为社区版本和企业版,也就是Docker CE和Docker EE, 原来Ubuntu14.04下,通过sudo apt-get install docker.i ...

  5. 记Windows10下安装Docker的步骤

    本文主要是记录吾八哥本人在Windows10下安装Docker的过程,当然这些步骤也是在网上搜索查阅资料得知而来的!具体步骤如下: 一.启用Hyper-V 打开控制面板 - 程序和功能 - 启用或关闭 ...

  6. docker学习笔记(一)—— ubuntu16.04下安装docker

    docker学习笔记(一)—— ubuntu16.04下安装docker 原创 2018年03月01日 14:53:00 标签: docker / ubuntu 1682 本文开发环境为Ubuntu ...

  7. Docker最全教程之Ubuntu下安装Docker(十四)

    前言 Ubuntu是一个以桌面应用为主的开源GNU/Linux操作系统,应用很广.本篇主要讲述Ubuntu下使用SSH远程登录并安装Docker,并且提供了Docker安装的两种方式,希望对大家有所帮 ...

  8. ubuntu 下安装docker 踩坑记录

    ubuntu 下安装docker 踩坑记录 # Setp : 移除旧版本Docker sudo apt-get remove docker docker-engine docker.io # Step ...

  9. docker(一) Centos7下安装docker

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

随机推荐

  1. 同时安装了python和3,pycharm如何切换版本

    1.打开pycharm 2.进入  File->Setting->Project:你的项目名->Project Interpreter 3.通过Project Interpreten ...

  2. 【转载】sql-builder介绍

    原文链接:sql-builder介绍 关于sql-builder sql-builder尝试使用java对象,通过类SQL的拼接方式,动态快速的生成SQL.它可作为稍后的开源项目ibit-mybati ...

  3. 解决BitLocker反复提示恢复密钥正确而无法进入系统的问题

    前一阵电脑因为装了grub,引导策略被改了.开Windows要求输入恢复密钥以进行恢复.我登陆过Microsoft账户所以在官网上找到了密钥并恢复了驱动器.但是进去提示"恢复密钥正确&quo ...

  4. findContours()函数

    函数原型 findContours(InputOutputArray image, OutputArrayOfArrays contours, OutputArray hierarchy, int m ...

  5. 清北学堂—2020.1提高储备营—Day 3(图论初步(二))

    qbxt Day 3 --2020.1.19 济南 主讲:李奥 目录一览 1.图论(kruskal算法,最短路径算法,拓扑排序) 总知识点:图论 一.kruskal算法 1.目的:求图的最小生成树 2 ...

  6. PostgreSQL内核学习笔记四(SQL引擎)

    PostgreSQL实现了SQL Standard2011的大部分内容,SQL处理是数据库中非常复杂的一部分内容. 本文简要介绍了SQL处理的相关内容. 简要介绍 SQL文的处理分为以下几个部分: P ...

  7. YARN安装和使用

    简介 Yet Another Resource Negotiator ,负责整个集群资源的调度,和管理,支持多框架资源统一调度(HIVE spark flink) 开启yarn 安装hadoop,可以 ...

  8. Vmvare扩展虚拟机磁盘大小

    Vmvare设置好虚拟机的磁盘大小之后,发现磁盘空间不够了,这个时候怎么扩展磁盘的大小呢? 首先,在确保虚拟机关闭的情况下,右键设置,选择硬盘,扩展,这样就可以增加磁盘的大小. 但是由于未进行分区和磁 ...

  9. 剑指offer-面试题43-1~n整数中1出现的次数-归纳法

    /* 题目: 求出1~13的整数中1出现的次数,并算出100~1300的整数中1出现的次数? 为此他特别数了一下1~13中包含1的数字有1.10.11.12.13因此共出现6次,但是对于后面问题他就没 ...

  10. kafka消费服务调优

    1.消费服务速度跟不上 2.top -H 观察是哪个线程最忙 3.多次使用jstack,看看最忙的那个线程在做什么