报错:Error response from daemon:
failed to create task for container:
failed to create shim task:
OCI runtime create failed:
runc create failed: unable to start container process:
error during container init:
error mounting "/opt/docker/nginx/nginx.conf" to rootfs at "/etc/nginx/nginx.conf": create mount destination for /etc/nginx/nginx.conf mount: cannot mkdir in /var/lib/docker/overlay2/e320de6293565b58052280ddbb78871b2141dab781d82553c54e773ad00a72c2/merged
/etc/nginx/nginx.conf: 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.
报了好长一串的错。。。看的我眼睛都花了,其实是因为挂载的容器那边是一个文件,而宿主机这边是一个目录文件夹,类型不一样,所以报错了,只需要把宿主机这边的目录删掉,建一个同名的文件即可
可以看到这个东西无法cat查看,它是一个目录
1.删掉宿主机的此目录,并建一个同名文件
2.删掉该容器,并重新构造一个
可以看到成功了