博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux中修改docker镜像源及安装docker
阅读量:5241 次
发布时间:2019-06-14

本文共 3572 字,大约阅读时间需要 11 分钟。

 

1、首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

2、进入yum源配置文件所在的文件夹

cd /etc/yum.repos.d/

3、下载163的yum源配置文件(CentOS7)

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

清华大学镜像源地址:https://mirrors.tuna.tsinghua.edu.cn/

4、清理缓存

yum clean all

5、测试下载安装

yum install gcc

6、安装docker

yum install docker

7、启动

systemctl start docker

8、启动报错

[root@localhost yum.repos.d]# systemctl start dockerJob for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.[root@localhost yum.repos.d]# systemctl status docker● docker.service - Docker Application Container Engine   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)   Active: failed (Result: exit-code) since Wed 2018-12-12 07:27:23 UTC; 28s ago     Docs: http://docs.docker.com  Process: 4166 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: 4166 (code=exited, status=1/FAILURE)Dec 12 07:27:21 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...Dec 12 07:27:22 localhost.localdomain dockerd-current[4166]: time="2018-12-12T07:27:22.024162402Z" level=warning msg="could not change group /var/run/docker...t found"Dec 12 07:27:22 localhost.localdomain dockerd-current[4166]: time="2018-12-12T07:27:22.038636556Z" level=info msg="libcontainerd: new containerd process, pid: 4170"Dec 12 07:27:23 localhost.localdomain dockerd-current[4166]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. ...d=false)Dec 12 07:27:23 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILUREDec 12 07:27:23 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.Dec 12 07:27:23 localhost.localdomain systemd[1]: Unit docker.service entered failed state.Dec 12 07:27:23 localhost.localdomain systemd[1]: docker.service failed.Hint: Some lines were ellipsized, use -l to show in full.

根据提示查看一下详情,执行:journalctl -xe

Dec 13 06:42:24 localhost.localdomain dockerd[2719]: time="2018-12-13T06:42:24.350020859Z" level=info msg="libcontainerd: new containerd process, pid: 2722"Dec 13 06:42:25 localhost.localdomain dockerd[2719]: time="2018-12-13T06:42:25.356303658Z" level=error msg="[graphdriver] prior storage driver overlay2 failed: driver Dec 13 06:42:25 localhost.localdomain dockerd[2719]: Error starting daemon: error initializing graphdriver: driver not supported

错误原因:error initializing graphdriver: driver not supported

解决办法:在 /etc/docker 目录下创建daemon.json文件,并且加入以下配置

touch daemon.jsonvi daemon.json{  "storage-driver": "overlay2",  "storage-opts": [    "overlay2.override_kernel_check=true"  ]}

再次启动

systemctl start docker

问题解决

 9、又来一个问题

Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot

此linux的内核中的SELinux不支持 overlay2 graph driver ,解决方法有两个,要么启动一个新内核,要么就在docker里禁用selinux,–selinux-enabled=false

vi /etc/sysconfig/docker#设置--selinux-enabled=false

 

转载于:https://www.cnblogs.com/lifuhei/p/10114054.html

你可能感兴趣的文章
721. Accounts Merge
查看>>
「Unity」委托 将方法作为参数传递
查看>>
重置GNOME-TERMINAL
查看>>
redis哨兵集群、docker入门
查看>>
hihoCoder 1233 : Boxes(盒子)
查看>>
oracle中anyData数据类型的使用实例
查看>>
C++对vector里面的元素排序及取任意重叠区间
查看>>
软件测试——性能测试总结
查看>>
12.4站立会议
查看>>
Java Concurrentmodificationexception异常原因和解决方法
查看>>
客户端访问浏览器的流程
查看>>
codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)
查看>>
c++||template
查看>>
[BZOJ 5323][Jxoi2018]游戏
查看>>
编程面试的10大算法概念汇总
查看>>
Vue
查看>>
python-三级菜单和购物车程序
查看>>
条件断点 符号断点
查看>>
VMware12 + Ubuntu16.04 虚拟磁盘扩容
查看>>
水平垂直居中
查看>>