使用docker-compose,使用 Nginx 基础映像中存在的目标目录安装卷可以按预期工作。docker-compose up但是,当挂载目标是在派生映像中创建的子目录时,我收到错误。这是错误的要点:
\n\n将“newdir”安装到“/usr/share/nginx/html/newdir”处的rootfs导致:\ nmkdir newdir:只读文件系统:未知
\n
我不明白为什么它似乎在尝试创建已经存在的目录( newdir )!
\n完整错误如下:
\nERROR: for test_nginx_1 Cannot start service nginx: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/home/user/test/newdir" to rootfs at "/usr/share/nginx/html/newdir" caused: mkdir /var/lib/docker/overlay2/accdaa147d7825a7d2c71b68f76e0b8663d00f6e46fcfb5c0ec32ada8baf85af/merged/usr/share/nginx/html/newdir: read-only file system: unknown\n\nERROR: for nginx Cannot start service nginx: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting …Run Code Online (Sandbox Code Playgroud)