【发布时间】:2022-04-29 22:13:03
【问题描述】:
我在执行下一个 docker 指令时遇到问题:
# make a directory
mkdir /server/nginx
cd /server/nginx
# make a container
docker run --name nginx \
-d -p 8080:8080 \
-v /home/www:/home/www \
-v /home/www:/usr/share/nginx/html \
-v "$PWD"/nginx.conf:/etc/nginx/nginx.conf \
-v "$PWD"/logs:/var/log/nginx \
-v "$PWD"/conf.d:/etc/nginx/conf.d \
--link php \
-d nginx
我得到下一个错误
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/server/nginx/nginx.conf" to rootfs at "/etc/nginx/nginx.conf" caused: mount through procfd: 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.
Docker 生成了下一个目录:
drwxr-xr-x 5 根 4096 1 月 7 日 05:03 ./
drwxr-xr-x 8 根 4096 1 月 7 日 04:49 ../
drwxr-xr-x 2 根4096 Jan 7 05:03 conf.d/
drwxr-xr-x 2 root root 4096 Jan 7 05:03 logs/
drwxr-xr-x 2 root root 4096 Jan 7 05:03 nginx.conf/
什么时候需要文件而不是目录。
【问题讨论】: