Docker File


FROM: It defines the build image to start the build process. It’s the fist command declared inside the Dockerfile.

FROM ubuntu

MAINTAINER: Author details of the docker file

RUN: It takes the command as argument and runs it from the base image. Execute during build process.

RUN: apt-get install git

EXPOSE: It uses to enable the specified port in order to make the communication between container and outside world

EXPOSE 8080

VOLUME: It enable access from your container to a directory in the host machine.

VOLUME: /MYVOLUME

CMD: It provides defaults for an executing container. CMD is default argument passed to the ENTRYPOINT,

Note: Argument sets with CMD can be overridden by RUN

CMD "echo "Hello World"

ENTRYPOINT: Use to execute any executable file during run time. It cannot to override it an immutable command.

ENTRYPOINT: echo

WORKDIR: it’s directive to point the location where the command defined with CMD runs

WORKDIR ~/

ENV: It used to set environment variables this value can be accessed via running scripts.

ENV foo=/bar

USER: It used to set the UID/Username

USER: 588

ADD: It can able to copy the content from remote URL or extracting a file to the container.

ADD http://example.com/foobar /

Post navigation

Leave a Reply