Docker 运行 nginx -v 设置容器数据卷遇到的问题
docker run -d -p 80:80 -v /study/nginx/nginx.conf:/etc/nginx/nginx.conf nginx
如果不加"-v /study/nginx/nginx.conf:/etc/nginx/nginx.conf "是可以成功启动的,但是想要修改nginx.conf,想把nginx.conf同步到宿主机上好做修改,遇到个这样的错误,百度了半天也没能解决,请大神帮忙看看
报错信息:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:430: container init caused \"rootfs_linux.go:58: mounting \\\"/study/nginx/nginx.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/b9f67d5d92d6881f5225be0fe6276d92a1e8e3fc5e69841c75972ed8f584ffac/merged\\\" at \\\"/var/lib/docker/overlay2/b9f67d5d92d6881f5225be0fe6276d92a1e8e3fc5e69841c75972ed8f584ffac/merged/etc/nginx/nginx.conf\\\" caused \\\"not a directory\\\"\"": unknown: 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.