DevOps Classroomnotes 24/Aug/2023

Docker contd

Containerization

  • This refers to the process of running the application in containers
  • This majorly means creating a Dockerfile for every application developed by your dev team

Case-Study: spring petclinic

  • This is a sample java application
  • Application download location Refer Here
  • To run this application we need java 11 and 8080 port to access the application
  • How this application is executed
    Preview

Manual steps:

  • Create an ubuntu linux vm and login into that
  • Now install jdk 11
sudo apt update
sudo apt install openjdk-11-jdk -y
  • Now download the application
cd /tmp
wget https://referenceapplicationskhaja.s3.us-west-2.amazonaws.com/spring-petclinic-2.4.2.jar
  • Now to run the application
java -jar /tmp/spring-petclinic-2.4.2.jar

Preview
* Now access the application http://<public-ip>:8080
Preview

Problem statement

  • We need to create a docker image for the application whenever there are code changes.
  • The process
    • cannot be manual
    • has to simple
    • supports making changes
    • steps needs to be version controlled.

Docker Image information

  • Docker hub has 3 types of images
    • official images
    • Verified Publisher
    • Community Images
  • Registries like DockerHub have repositories.
  • Each Docker Image will have a Repository
  • Docker image name convention
# for non official images
<username>/<repository>:<tag>
# for offical images
<repository>:<tag>
  • Tag in Docker image represents a version.
  • If the tag is not specified docker will replace tag with latest
# image name
nginx 
    => official repo => nginx
    => tag is latest

jenkins/jenkins:lts-jdk11
    => username = jenkins
    => repo => jenkins
    => tag => lts-jdk11

Port forwarding

  • Overview
    Preview
  • Example:
docker container run -d --name mynginx -p 44444:80 nginx

Preview

Ways of Working Building Docker Images

  • Choose the right base image
  • Composing a 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 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