解决 error creating overlay mount to /var/lib/docker/overlay2

最近在centos7.1使用docker运行redis镜像,出现下面的错误:

ERROR: for ddns  Cannot start service ddns: error creating overlay mount to /var/lib/docker/overlay2/f861b6ba19002faade18e4c75c3772ccafcd09696acf969fab17f005cc7a6eed/merged: invalid argument

ERROR: for mysql  Cannot start service mysql: error creating overlay mount to /var/lib/docker/overlay2/7c378a17a38fc6749c61e3adde2327d542ac7539c6f988864248cf1c832a98c2/merged: invalid argument

ERROR: for redis  Cannot start service redis: error creating overlay mount to /var/lib/docker/overlay2/6f38c8f2d45d87af80a37b0cf1ebf6e4abc96ba356dcce486ed4bc6de309d8f1/merged: invalid argument

ERROR: for ddns  Cannot start service ddns: error creating overlay mount to /var/lib/docker/overlay2/f861b6ba19002faade18e4c75c3772ccafcd09696acf969fab17f005cc7a6eed/merged: invalid argument

ERROR: for mysql  Cannot start service mysql: error creating overlay mount to /var/lib/docker/overlay2/7c378a17a38fc6749c61e3adde2327d542ac7539c6f988864248cf1c832a98c2/merged: invalid argument
ERROR: Encountered errors while bringing up the project.

停止docker服务

systemctl stop docker

清理镜像

rm -rf /var/lib/docker

修改存储类型

vi /etc/sysconfig/docker-storage

把空的DOCKER_STORAGE_OPTIONS参数改为overlay:

DOCKER_STORAGE_OPTIONS="--storage-driver overlay"
vi /etc/sysconfig/docker

禁用selinux

方法1:

去掉option的–selinux-enabled

方法2:

永久关闭:输入命令vi /etc/selinux/config,将SELINUX=enforcing改为SELINUX=disabled,然后保存退出。

启动docker应该就可以了

systemctl start docker