DevOps Classroom notes 07/Jan/2024

Dockerfile contd

ADD COPY:

  • To copy the files into docker image
  • Refer Here for ADD and Refer Here for COPY instructions official docs
  • ADD and COPY both copy the files into Docker image where as
    • ADD can copy from local as well remote files into docker image
    • COPY can copy files or folders from local system only
  • Refer Here for the changes done to containerize the game of life application

WORKDIR: Default directory when container starts

  • Refer Here for official docs
  • Lets implement WORKDIR in spring petclinic with /spc
  • Refer Here for the changes

USER

  • Refer Here for USER instruction.
  • Lets run the spring petclinic as non root user Refer Here for the changes done
    Preview

Parametrization

  • Dockerfile allows paramterization at two levels
    • while building the image
    • while running the container
      • ENV

Buildtime variables using ARG

Envrionmental variables using ENV

SHELL FORM and EXEC FORM

  • Shell form: write the command directly
ping google.com
  • EXEC form: write the command in the following formats
 ["ping", "google.com"]
  • Recommendataions
    • RUN use shell form
    • CMD/ENTRYPOINT: use exec form

Exercise

  • Give me a command to create a linux user which doesnot asks me questions
    • It should create a user with a home director and shell setup
addgroup -g 1000 spc
adduser -h "/spc" -u 1000 -G spc -s /bin/bash -D spc
  • Look into jenkins/jenkins Dockerfile

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