DevOps Classroom notes 21/May/2026

Dockerfile instructions

CMD and ENTRYPOINT

  • These instructions will be executed when we are staring the container using the image
  • If neither of them are specified, then base images CMD or ENTRYPOINT wll be used.
  • In the following case, then docker will be excute NGINX CMD or Entrypoint
FROM nginx
RUN touch 1.txt
  • Your container will be in running state as long the CMD or entrypoint is running
  • CMD can be overriten
docker run -d --name test3 test:2 sleep 10s
sleep 10s will overrite CMD
  • If Entrypoint instruction exists then the start command would be ENTRYPOINT + CMD
FROM alpine
ENTRYPOINT ["sleep"]
CMD ["20s"]
  • ENTRYPOINT can also be changed by using --entrypoint
  • ideally your entrypoint + cmd should be executing as long as your application runs
  • IF your container has server like nginx, apache, tomcat etc dont write entrypoint

EXPOSE

  • This tells docker engine on which port your applicaion is running

LABEL

  • This adds metadata

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube