DevOps Classroomnotes 27/Aug/2023

Containerization using Dockerfile (contd..)

ADD and COPY: instructions to copy the contents into image

ADD <src> <dest>
COPY <src> <dest>
  • ADD supports to copy from url’s whereas copy can copy from docker host into image

WORKDIR: working directory

USER: sets the username

ARG: Parametrize while building image

  • Refer Here for official docs
  • ARG can provide a way to pass build time variables (they are available only during image building)

ENV: Environmental variables can be passed during container creation

Building springpetclinic

  • Refer Here for the changes to include add statement
  • build the docker image with repo petclinic and tag v1.0.0-slim
    Preview
  • Running application from root folder mightnot be a good idea, lets create a directory for petclinic and run our application from there.
  • Running application with root previleges poses security risks, so lets run the spring petclinic with a new user called as petclinic
  • Refer Here for the changes done to accomodate user and workdir
  • build the docker image with repo petclinic and tag v1.1.0-slim
    Preview
  • Now run the container in detached mode with name pcnew
    Preview
  • Build the image with username=qtdevops homedir=/lt petclinic and tag qt-slim
    Preview
    Preview
  • Demonstrate usage of environmental variables, Refer Here for changes
    Preview
  • Now lets run the container and change the value of test while creation
    Preview
    Preview

Exercise

  • Simple:
    • Gameoflife application: Refer Here for war file
      • requires:
        • jdk8
        • tomcat 8 or 9
      • Copy the war file into webapps folder of tomcat 9
      • Access the application by <tomcat-url>/gameoflife
  • Tricky: Refer Here for nopCommerce on Linux
    • Note: dont focus on database, configure the rest.

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 Wordpress Development 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