将Dockerfile从Windows文件系统复制到Docker容器
我有一个简单的 Dockerfile :
FROM php:7.1-apache
LABEL maintainer="rburton@agsource.com"
COPY C:/Users/rburton/code/MyAgsourceAPI /var/www
这是给我带来麻烦的最后一行。我正在从Windows结构复制到docker容器(我假设是Linux)。当我构建此图像时,我得到:
It is the last line that is giving me problems. I am copying from a Windows structure to a docker container (Linux I assume). When I build this image I get:
...
Step 3/3 : COPY C:/Users/rburton/code/MyAgsourceAPI /var/www
COPY failed: stat /var/lib/docker/tmp/dockerbuilder720374851/C:/Users/rburton/code/MyAgsourceAPI: no such file or directory
首先,有些东西阻止了人们认识到这是一条绝对路径,如果路径前面加上了 / var / lib / docker / tmp / dockerbuilder720374851
,将找不到该文件。其次,我尝试了 /
和 \
,但是所有结果都相同。另外我怀疑的驱动器号使docker感到困惑。所以问题是如何将文件和文件夹(以及内容)从Windows文件夹复制到Docker容器?
First, something is preventing the recognition that this is an absolute path and naturally if the path is pre-pended with /var/lib/docker/tmp/dockerbuilder720374851
then the file will not be found. Second, I have tried /
and \
but all with the same result. Also the drive letter I suspect is confusing to docker. So the question is how do I copy files and folders (along with the contents) from a Windows folder to a docker container?
首先,将您的 Dockerfile
更改为:
FROM php:7.1-apache
LABEL maintainer="rburton@agsource.com"
COPY MyAgsourceAPI /var/www
然后转到您的代码
目录: cd Users / rburton / code
。
在该目录内,运行: docker build -t< image_name> 。