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 comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%