From what I know, docker-machine
automatically mounts the C:/Users/<username>
directory in windows. I am able to access it from the quick start terminal as /c/Users/<username>
and perform all sorts of operations on it.
However when I RUN
a command from inside Dockerfile
, docker engine simply doesn't recognize this mounted path.
For instance I have activator
zip located at:
/c/Users/someuser/somefolder/typesafe-activator-1.3.10.zip
Previously, I was using wget
in Dockerfile
:
RUN wget https://downloads.typesafe.com/typesafe-activator/1.3.10/typesafe-ctivator-1.3.10.zip && unzip typesafe-activator-1.3.10.zip
Now since I already have this zip in the file system, I want to:
RUN cp /c/Users/someuser/somefolder/typesafe-activator-1.3.10.zip . && unzip typesafe-activator-1.3.10.zip
But I get:
cp:cannot stat '/c/Users/someuser/somefolder/typesafe-activator-1.3.10.zip': No such file or directory
Any one know how I can get a file from the shared folders on the host machine into the docker build process?
UPDATE
Here is my complete Dockerfile
:
FROM openjdk:8
ENV PROJECT_WORKPLACE /usr/src
RUN mkdir -p $PROJECT_WORKPLACE/activator $PROJECT_WORKPLACE/build $PROJECT_WORKPLACE/app
WORKDIR $PROJECT_WORKPLACE/activator
COPY . typesafe-activator-1.3.10.zip
RUN unzip typesafe-activator-1.3.10
ENV PATH $PROJECT_WORKPLACE/activator/typesafe-activator-1.3.10/activator-dist-1.3.10/bin:$PATH
COPY . $PROJECT_WORKPLACE/build
WORKDIR $PROJECT_WORKPLACE/build
RUN activator clean stage
RUN cp -R $PROJECT_WORKPLACE/build/target/universal/stage $PROJECT_WORKPLACE/app
EXPOSE 9000
CMD $PROJECT_WORKPLACE/app/stage/bin/docker-play -Dhttp.port=9000 -Dlogger.file=$PROJECT_WORKPLACE/build/logger.xml
The RUN sees the Dockerfile context:
The context is the current folder (where the Dockerfile is) and its subfolder.
Therefore, You don't need to specify the all path.
Note: you should use
COPY
orADD
instead ofRUN cp
In any case, any resource you need should be in the same folder or subfolder of your Dockerfile.
The OP egima made it work with: