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. Flink中逻辑计划和物理计划的概念划分和对应关系

    逻辑计划 logicGraph或者jobGraph,其端点为operator,edge为数据流向. operator往往代表一个函数. 同一个分区内的具有连续上下游关系的函数组成operator-ch ...

  2. 使用CSV Data Set Config配置原件,参数化数据

    对接口数据的参数化方式大概有三种方式,1:jmeter内置函数:2:借助CSV Data Set Config配置原件:3:jdbc连接数据库,使用数据表字段 此处主要讲第二种:借助CSV Data ...

  3. LeetCode 面试题18. 删除链表的节点

    题目链接:https://leetcode-cn.com/problems/shan-chu-lian-biao-de-jie-dian-lcof/ 给定单向链表的头指针和一个要删除的节点的值,定义一 ...

  4. Linux高性能服务器编程:Linux服务器程序规范

    Linux服务器程序一般以后台进程形式运行,后台进程又称守护进程.它没有控制终端,不会接收到用户输入.守护进程的父进程通常是init进程(PID为1). Linux服务器程序有一套日志系统 Linux ...

  5. JS笔记之第一天

    JavaScript:简称JS JS的原名不是JavaScript,而是LiveScript JS分为三个部分 1.ECMAScript  标准→JS的基本的语法 2.DOM——Document Ob ...

  6. 剑指offer-面试题39-数组中出现次数超过一半的数字-快速排序

    /* 题目: 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字. 例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组中出现了5次,超过数组长度的一半,因此输 ...

  7. 社会工程学 | 浅谈“答题”APP的赌博骗局

    本文写于2018年2月18日,转载于我的知乎文章,请结合实际阅读. 这么多年来在认识的网骗手段越来越多了,考虑到今后工作方向,会继续记录.   微信小程序"头脑王者"被封禁后,更多 ...

  8. hibernate报错:MappingException: Could not determine type for...解决办法

    有时候实体里的一些属性并不想映射到数据库(比方说子级菜单List), 如果不做处理的话会报字段映射错误找不到这列Column Not Found 例如:org.hibernate.MappingExc ...

  9. Java商城秒杀系统的设计与实战视频教程(SpringBoot版)

    课程目标掌握如何基于Spring Boot构建秒杀系统或者高并发业务系统,以及构建系统时采用的前后端技术栈适用人群Spring Boot实战者,微服务或分布式系统架构实战者,秒杀系统和高并发实战者,中 ...

  10. spring boot的一个小项目小型进销存系统

    项目所需的依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId&g ...