πŸš€ DevOps Certified Professional
πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 | 🀝 +1 (469) 756-6329 πŸ” Contact@DevOpsSchool.com

Day-2 Assigment-1

DevOps

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

What about if you 2 CMD?

It will remove the intermediate container and take the latest changes.

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 world"
CMD echo "Hi"

result:
Hi
Last CMD will be executed.

What about if you 2 ENRTYPOINT?

It will remove the intermediate container and take the latest changes.

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"]
ENTRYPOINT ["/bin/echo", "Hi"]

result:
Hi
Last Entry point will be executed.

What about if you 1 ENRTYPOINT 1 CMD?

Entry point executed first then CMD executed.

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", "Hi"]
CMD echo "Hello world"

Output:
Hi /bin/sh -c echo "Hello world"