0
我有問題來配置我的docker-compose文件,docker可以在重新啓動時重新啓動容器(我的操作系統是Ubuntu 16.04)。問題不在我通過restart: always
時,但當我的容器需要一些基於卷的文件(例如ssl-cert到nginx)時。我的代碼(在docker-compose.yml中):Docker卷,並重新啓動始終啓用選項
php:
entrypoint: ["wait-for-it", "dockerhost:3306", "-t", "0", "--", "/install.sh"]
environment:
- ENVIRONMENT=prod
volumes:
- ${FILE}:/file
- /code
env_file:
- prod.env
restart: always
當我自己啓動它時,一切正常。然後我檢查它是否會在重新啓動後運行。但是,不,它不工作,給出:
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": ""
}
]
我敢肯定,嘿嘿。 txt文件是一個文件,而不是目錄。如果我說將容量掛載到目錄的容器中運行良好,可能會有所幫助。請幫忙,已經搜索了整個互聯網,沒有什麼可以工作。謝謝
是的,當我將文件源更改爲/ etc/file時,確實有'type ecryptfs'一切正常 – PianistaMichal