
Commands in ENTRYPOINT will always be executed. ENTRYPOINTĮNTRYPOINT is similar to CMD, Commands after entrypoint will take arguments from CMD or in other words we can say that CMD is the argument for ENTRYPOINT. If you have noticed when we run a container we get a bash shell, because of CMD keyword (CMD /bin/bash). Whenever we use multiple CMD keywords then the latest one will get the preference. WORKDIR is used to defined working directory of a container for executing COPY, ADD, RUN, CMD and ENTRYPOINT instructions.Ĭommands mentioned after CMD keyword will executed when a container is launched (run) from a docker image RUN echo 'apache2ctl start' > /root/.bashrc WORKDIR RUN echo 'Web site Hosted inside a container' > /var/ww/html/index.html Name of the community or owner who maintains docker image is specified under MAINTAINER Keyword.Ĭommands mentioned after RUN keyword will be executed during creation of Docker image

Some of the Keywords which are generally used in a Dockerfile are listed below: FROMįrom keyword specify the name of image that will be used as base image while building the Docker Image, Docker command will search this image locally and if it is not found in local registry then it will try to fetch it from docker hub registry. Let’s assume we want to build Jboss EAP docker image.

In this post, we will cover how to build docker image from a Dockerfile step by step.
