在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/Java  Linux/ docker 創(chuàng)建nginx容器時(shí)對(duì)配置文件進(jìn)行掛載時(shí)報(bào)錯(cuò),有那大佬熱心提點(diǎn)提點(diǎn)

docker 創(chuàng)建nginx容器時(shí)對(duì)配置文件進(jìn)行掛載時(shí)報(bào)錯(cuò),有那大佬熱心提點(diǎn)提點(diǎn)!感謝感謝!?。?!

docker 以及 ngixn鏡像信息如下:

root@iZ28q62x60iZ:/srv/testServer# docker -v
Docker version 18.03.1-ce, build 9ee9f40
root@iZ28q62x60iZ:/srv/testServer# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              649dcb69b782        19 hours ago        109MB
root@iZ28q62x60iZ:/srv/testServer# 

執(zhí)行錯(cuò)誤報(bào)如下錯(cuò)誤:

root@iZ28q62x60iZ:/srv/testServer# docekr run --name nginx -d -p 80:80 -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf nginx
No command 'docekr' found, did you mean:
 Command 'docker' from package 'docker.io' (universe)
docekr: command not found
root@iZ28q62x60iZ:/srv/testServer# docker run --name nginx -d -p 80:80 -v $PWD/conf/nginx.conf:/etc/nginx/nginx.conf nginx
4db2ddccc4022c305991a1dce568fd8332087d5543a56f4a573cde69de33feb8
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/srv/testServer/conf/nginx.conf\\\" to rootfs \\\"/var/lib/docker/overlay2/3d4b01b3ed517480faba01aa1edb6fbb9e2dc01d5de5239e8c8d00d3a159777a/merged\\\" at \\\"/var/lib/docker/overlay2/3d4b01b3ed517480faba01aa1edb6fbb9e2dc01d5de5239e8c8d00d3a159777a/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.
root@iZ28q62x60iZ:/srv/testServer# 
回答
編輯回答
嫑吢丕

第一條命令,docker 拼錯(cuò)了。

第二條命令的報(bào)錯(cuò)信息很明顯:

$PWD/conf/nginx.conf 是目錄,而鏡像中的 /etc/nginx/nginx.conf 是 regular file, volume mount 失敗。

剩下怎么解決應(yīng)該不用提示吧,該刪刪,該建建

建議仔細(xì)看下nginx鏡像中配置文件的目錄結(jié)構(gòu),比如 /etc/nginx/conf.d/, 如果只是增加 server block,不必修改默認(rèn)設(shè)置

2017年10月3日 08:46