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

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


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

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
  • Example:
docker container run -d --name mynginx -p 44444:80 nginx

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 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%%