Write an example dockerfile with 2 CMD, 2 ENTRYPOINT and 1 CMD/1 ENTRYPOINT and write down behavior of it.

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

root@ip-172-31-28-155:/home/ubuntu/srm# cat dockerfile_multi
FROM ubuntu
MAINTAINER Rajesh Kumar << rajesh@scmgalaxy.com>>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install tzdata
RUN apt-get install git -y && apt-get install -yq apache2
CMD echo “Hello CMD kp”
ENTRYPOINT [“/bin/echo”, “Hello Entry kannan”]

root@ip-172-31-28-155:/home/ubuntu/srm# docker run -it image_multi
Hello Entry kannan /bin/sh -c echo “Hello CMD kp”

root@ip-172-31-28-155:/home/ubuntu/srm# cat dockerfile_multi
FROM ubuntu
MAINTAINER Rajesh Kumar << rajesh@scmgalaxy.com>>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install tzdata
RUN apt-get install git -y && apt-get install -yq apache2
CMD echo “Hello CMD kp”
CMD echo “Hello CMD kannan”

root@ip-172-31-28-155:/home/ubuntu/srm# docker run -it image_multi
Hello CMD kannan

root@ip-172-31-28-155:/home/ubuntu/srm# cat dockerfile_multi
FROM ubuntu
MAINTAINER Rajesh Kumar << rajesh@scmgalaxy.com>>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install tzdata
RUN apt-get install git -y && apt-get install -yq apache2
ENTRYPOINT [“/bin/echo”, “Hello Entry k”]
ENTRYPOINT [“/bin/echo”, “Hello Entry kp”]

root@ip-172-31-28-155:/home/ubuntu/srm# docker run -it image_multi
Hello Entry kp