I have written a Dockerfile which looks like this
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y wget
Now I'm having a file called abc.txt
in my host machine. How can I copy it to this container. Is there any step that I can add in Dockerfile which copy from Host to Container.
Use COPY command like this:
COPY foo.txt /data/foo.txt
# where foo.txt is the relative path on host
# and /data/foo.txt is the absolute path in the image
read more details for COPY in the official documentation
An alternative would be to use ADD but this is not the best practise if you dont want to use some advanced features of ADD like decompression of tar.gz files.If you still want to use ADD command, do it like this:
ADD abc.txt /data/abc.txt
# where abc.txt is the relative path on host
# and /data/abc.txt is the absolute path in the image
read more details for ADD in the official documentation