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
  • 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
  • Now run the container in detached mode with name pcnew
  • Build the image with username=qtdevops homedir=/lt petclinic and tag qt-slim

  • Demonstrate usage of environmental variables, Refer Here for changes
  • Now lets run the container and change the value of test while creation

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 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
Customized Social Media Icons from Acurax Digital Marketing Agency
Exit mobile version
%%footer%%