[英]Local volume not mount/bind with container while running IIS docker file [On Windows]
OS:Win 10 Pro 操作系统:Win 10 Pro
My IIS Docker file: 我的IIS Docker文件:
FROM microsoft/iis:latest
RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot\*
WORKDIR /inetpub/wwwroot
COPY content/ .
EXPOSE 80
Build command: 生成命令:
C:\Users\admin\Desktop\iis-demo>docker build -t iis-image .
Sending build context to Docker daemon 6.656kB Step 1/5 : FROM microsoft/iis:latest
---> 248afbbe0fd1 Step 2/5 : RUN powershell -NoProfile -Command Remove-Item -Recurse C:\inetpub\wwwroot*
---> Using cache
---> 880273c74891 Step 3/5 : WORKDIR /inetpub/wwwroot
---> Using cache
---> a07a920df3bf Step 4/5 : COPY content/ .
---> ab16da97c523 Step 5/5 : EXPOSE 80
---> Running in 98b7cbef83c9 Removing intermediate container 98b7cbef83c9
---> 1c7d232a73aa Successfully built 1c7d232a73aa Successfully tagged iis-image:latest
Run Command: 运行命令:
C:\Users\admin\Desktop\iis-demo>docker run -d -p 8080:80 -v C:\Users\admin\Desktop\iis-demo\content:/inetpub/wwwroot iis-image
i also tried with: 我也尝试过:
C:\Users\admin\Desktop\iis-demo>docker run -d -p 8080:80 -v C:\\Users\\admin\\Desktop\\iis-demo\\content:/inetpub/wwwroot iis-image
But everytime I am getting following error: 但是每次我得到以下错误:
docker: Error response from daemon: invalid volume specification: 'C:\\Users\\admin\\Desktop\\iis-demo\\content:/inetpub/wwwroot'.
泊坞窗:来自守护程序的错误响应:无效的卷规范:'C:\\ Users \\ admin \\ Desktop \\ iis-demo \\ content:/ inetpub / wwwroot'。 See 'docker run --help'.
请参阅'docker run --help'。
I believe your problem is the missing trailing slash. 我相信您的问题是缺少斜杠。
your code: 您的代码:
C:\Users\admin\Desktop\iis-demo>docker run -d -p 8080:80 -v C:\Users\admin\Desktop\iis-
demo\content:/inetpub/wwwroot iis-image
is trying to load the folder content
in the container if its not there is will fail try this: 正在尝试将文件夹
content
加载到容器中(如果不存在)将失败,请尝试以下操作:
C:\Users\admin\Desktop\iis-demo>docker run -d -p 8080:80 -v C:\Users\admin\Desktop\iis-
demo\content\:/inetpub/wwwroot iis-image
or in your file make the directory content
and change your command to 或在文件中添加目录
content
然后将命令更改为
docker run -d -p 8080:80 -v C:\Users\admin\Desktop\iis-
demo\content:/inetpub/wwwroot/content iis-image
without the /
you will add the directory with the /
you add the contents of the directory to the container destination 不带
/
的目录,将带/
的目录添加到容器目的地
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.