docker的部署会遇到什么问题(Docker相关异常问题汇总)

查看 Docker 的启动日志

[root@centos-101 ~]# journalctl -u docker.service

docker的部署会遇到什么问题(Docker相关异常问题汇总)(1)

[root@centos-101 ~]# systemctl status docker -l

docker的部署会遇到什么问题(Docker相关异常问题汇总)(2)


1. docker-compose up 异常 -- 'Mount denied:\nThe source path "\\var\\run\\docker.sock:/tmp/docker.sock"\n is not a valid Windows path'

解决办法:

在docker compose yaml 文件相同目录下,创建一个 .env 文件,添加如下配置:

COMPOSE_CONVERT_WINDOWS_PATHS=1

docker的部署会遇到什么问题(Docker相关异常问题汇总)(3)

参考链接:

https://github.com/docker/for-win/issues/1829#issuecomment-376328022

https://stackoverflow.com/questions/49507912/docker-jwilder-nginx-proxy-container-create-issue

=============================================


2. 通过 journalctl -xe 查看到的异常信息-/var/lib/docker 包含了多种有效的graphdrivers: devicemapper,overly;请清除或者显式选择storage driver。

6月 06 13:50:21 local dockerd[22018]: time="2018-06-06T13:50:21.016185408 08:00" level=warning msg="failed to rename /var/lib/docker/tmp for background deletion: rename /var/lib/docker/tmp /var/lib/docker/tmp-old: file exists. Deleting synchronously"

6月 06 13:50:21 local dockerd[22018]: time="2018-06-06T13:50:21.019150299 08:00" level=warning msg="overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type suppo

6月 06 13:50:21 local dockerd[22018]: Error starting daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: devicemapper, overlay; Please cleanup or explicitly choose storage driver (-s <DRIVER>)

6月 06 13:50:21 local systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE

6月 06 13:50:21 local systemd[1]: Failed to start Docker Application Container Engine.

-- Subject: Unit docker.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit docker.service has failed.

--

-- The result is failed.

6月 06 13:50:21 local systemd[1]: Unit docker.service entered failed state.

6月 06 13:50:21 local systemd[1]: docker.service failed.

6月 06 13:50:21 local systemd[1]: docker.service holdoff time over, scheduling restart.

6月 06 13:50:21 local systemd[1]: start request repeated too quickly for docker.service

6月 06 13:50:21 local systemd[1]: Failed to start Docker Application Container Engine.

-- Subject: Unit docker.service has failed

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit docker.service has failed.

--

-- The result is failed.

6月 06 13:50:21 local systemd[1]: Unit docker.service entered failed state.

6月 06 13:50:21 local systemd[1]: docker.service failed.

Error starting daemon: error initializing graphdriver: \"/var/lib/docker\" contains several valid graphdrivers: devicemapper, overlay; Please cleanup or explicitly choose storage driver (-s <DRIVER>)

到/var/lib/docker 目录查看,根据情况,将下面的overlay或者devicemapper文件夹删掉即可。这种情况发生在使用采用dc/os安装后,原有的devicemapper模式修改成了overlay,但是docker同时只能支持一种存储模式。

解决办法:

[root@local ~]# rm -r -f /var/lib/docker/overlay

[root@local ~]# ls /var/lib/docker

builder containerd containers devicemapper image network plugins runtimes swarm tmp tmp-old trust volumes

[root@local ~]# systemctl start docker.service

[root@local ~]# docker version

3. docker swarm join 报错 -- 证书过期或者还没有生效

[peter@minion ~]$ docker swarm join --token SWMTKN-1-3mj5po3c7o04le7quhkdhz6pm9b8ziv3qe0u7hx0hrgxsnaram-0p1f40vtehanu6ugw8ug2wasy 10.0.0.10:2377

Error response from daemon: error while validating Root CA Certificate: x509: certificate has expired or is not yet valid

原理:docker swarm node之间是加密传输,docker swarm init时会创建CA证书。这里提示证书过期或者还没有生效,可能是主机当前时间不对。

[root@centos103 ~]# date

Mon Jun 11 03:22:46 CST 2018

[root@centos103 ~]# ntpdate time.nist.gov

11 Jun 13:26:28 ntpdate[16620]: step time server 129.6.15.30 offset 36172.907214 sec

[root@centos103 ~]# date

Mon Jun 11 13:27:01 CST 2018

解决:sudo ntpdate time.nist.gov 同步一下时间

http://www.cnblogs.com/Peter2014/p/7728762.html



WARNING: ipv4 forwarding is disabled. Networking will not work.

https://blog.csdn.net/yjk13703623757/article/details/68939183

问题:

创建容器的时候报错WARNING: IPv4 forwarding is disabled. Networking will not work.

# docker run -it -p 30001:22 --name=centos-ssh centos /bin/bash

WARNING: IPv4 forwarding is disabled. Networking will not work.

解决办法:

# vim /usr/lib/sysctl.d/00-system.conf

添加如下代码:

net.ipv4.ip_forward=1

重启network服务

# systemctl restart network

完成以后,删除错误的容器,再次创建新容器,就不再报错了。

[root@centos103 ~]# vim /usr/lib/sysctl.d/00-system.conf

# Kernel sysctl configuration file

#

# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and

# sysctl.conf(5) for more details.

# Enable netfilter on bridges.

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

net.bridge.bridge-nf-call-arptables = 1

net.ipv4.ip_forward=1

修改完成之后,执行下面的命令,是修改立即生效:

sysctl --system

docker WARNING: bridge-nf-call-iptables is disabled 处理 --- 参考上面的解决措施。

查看是否修改成功:

[root@etcd1 volumes]# sysctl net.ipv4.ip_forward

net.ipv4.ip_forward = 1

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页