Docker卷,重启始终启用选项

我有问题configuration我的docker-compose文件,docker可以在重新启动时重新启动容器(我的操作系统是Ubuntu 16.04)。 问题不是当我通过restart: always进入它,但是当我的容器需要一些基于卷的文件(例如ssl-cert到nginx)。 我的代码(在docker-compose.yml中):

 php: entrypoint: ["wait-for-it", "dockerhost:3306", "-t", "0", "--", "/install.sh"] environment: - ENVIRONMENT=prod volumes: - ${FILE}:/file - /code env_file: - prod.env restart: always 

当我自己开始时,一切都很好。 然后我检查它是否会在重新启动后工作。 但是,不行, docker-compose ps给:

 Name Command State Ports ----------------------------------------------------------------------- panel_php_1 wait-for-it dockerhost:330 ... Exit 127 

通过执行docker inspect panel_php_1它回声错误:

 "Error": "oci runtime error: container_linux.go:247: starting container process caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:54: mounting \\\\\\\"/home/mblocinski/hehe.txt\\\\\\\" to rootfs \\\\\\\"/var/lib/docker/aufs/mnt/d746adf311098a9e2ffc27d9447a3e448ecfb9081ff4757704c24ec51ef9053e\\\\\\\" at \\\\\\\"/var/lib/docker/aufs/mnt/d746adf311098a9e2ffc27d9447a3e448ecfb9081ff4757704c24ec51ef9053e/file\\\\\\\" caused \\\\\\\"not a directory\\\\\\\"\\\"\"\n: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type" 

和坐骑:

 "Mounts": [ { "Type": "bind", "Source": "/home/mblocinski/hehe.txt", "Destination": "/file", "Mode": "rw", "RW": true, "Propagation": "" } ] 

我确定hehe.txt文件是一个文件,而不是目录。 如果我说将容量挂载到目录的容器中,可能会有所帮助。 请帮忙,已经搜遍整个互联网,没有什么真正的作品。 谢谢

检查/ home是否被encfsencryption。 默认情况下,Ubuntu在安装过程中configuration此function。

运行这个命令: mount|grep home并检查输出是否有type encfs东西。