part 4 docker automate building images

Build docker images

   docker file - is text doc that contains all the instructions to assemble the image

By default the filename is "Dockerfile" where we put all the instructions

cd /home/user1/

# vim Dockerfile
FROM debian:jessie
RUN apt-get update
RUN apt-get install -y git vim rsync
COPY localfile.txt  /src/localfile.txt   ##copy local file to containers /src/ directory ..look ADD command too!

docker build -t repositoryname:tag .


docker build -t vieux/apache:2.0 .

docker build -t urgen/dockerfiledemo -f Dockerfile /home/user1/

docker build -t urgen/dockerfiledemo -f customdockerfilemame /home/user1/

OR

docker build -t ubuntu:latest .

    --tag, -t  = Name and optionally a tag in the ‘name:tag’ format
    --file, -f = Name of the Dockerfile (Default is ‘PATH/Dockerfile’)


in screenshot "Dockerfile" is saved at /home/user1/docker directory

No comments:

Post a Comment