Docker:如何映射主机目录?

时间:2020-04-22 06:08:21

标签: docker

我正在尝试重现创建基于Ubuntu的映像+ nginx的步骤,在其中进行了描述: https://www.howtoforge.com/tutorial/how-to-create-docker-images-with-dockerfile/

我的主机是Windows。 映像已构建,然后在主机上创建了d:\ webroot文件夹,并在其中创建了index.html文件

docker run  -v /d/webroot:/var/www/html -p 80:80 --name doom nginx_image

standard_init_linux.go:211: exec user process caused "no such file or directory"

可能是什么原因以及如何解决?

1 个答案:

答案 0 :(得分:1)

问题是从Windows加载的start.sh脚本。摘录如下:

#!/bin/sh

/usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf

您需要将CRLF的更改行从LF更改为start.sh

然后运行:docker run -v /d/webroot:/var/www/html -p 80:80 --name doom nginx_image