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!
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 1"
ENTRYPOINT ["/bin/echo", "Hello Entry 1"]
root@ip-172-31-28-155:/home/ubuntu/srm# docker run -it image_multi
Hello Entry 1 /bin/sh -c echo "Hello CMD 1"
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 1"
CMD echo "Hello CMD 2"
root@ip-172-31-28-155:/home/ubuntu/srm# docker run -it image_multi
Hello CMD 2
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 1"]
ENTRYPOINT ["/bin/echo", "Hello Entry 2"]
root@ip-172-31-28-155:/home/ubuntu/srm# docker run -it image_multi
Hello Entry 2