Reputation: 19956
There is the following code In my Dockerfile :
ENV GOVERS 073fc578434b
RUN cd /usr/local && curl -O http://go.googlecode.com/archive/$GOVERS.zip
RUN cd /usr/local && unzip -q $GOVERS.zip
the above code downloads the zip file to the /usr/local
directory and all is ok. But now i do not want to download the zip file, I want to get the zip file from my local PC to the /usr/local
at the docker container.
Upvotes: 3
Views: 12423
Reputation: 3711
Another approach that I am starting to like is using volumes and runtime commands. I don't like to have to rebuild the image if I change something incidental.
So I create a volume in the docker file to transfer stuff back and forth: In Docker file:
RUN mkdir -p /someplace/dropbox
....
CMD ..... ; $POST_START ; tail -f /var/log/messages
on host:
mkdir /dropbox && cp ~/Downloads/fap.zip /dropbox \
docker run -v /dropbox:/someplace/dropbox \
-e POST_START="cp /someplace/dropbox/fap.zip /someplace-else; cd /someplace-else;unzip fap.zip" ..... <image>
Upvotes: 1
Reputation: 103965
Let say the zip file is named test.zip
and is located in the same directory as your Dockerfile, then you can make use of the COPY instruction in your dockerfile. You will then have:
COPY test.zip /usr/local/
RUN cd /usr/local && unzip -q test.zip
Furthermore you can use the ADD instruction instead of COPY
to also uncompress the zip file and you won't need to RUN the unzip command:
ADD test.zip /usr/local/
Upvotes: 3