DevOps Classroomnotes 19/Apr/2023

A Sample application

  • Python based application:
    • Web application
    • Database
  • Code: Refer Here
  • This application has a python web frontend.
  • Create a image by following instructions Refer Here
  • Create a mysql container according to docs
  • get the mysql ip address and pass it as environment variable to the python web application
  • What is that you need to do

    • Create a bridge network
    • Create a volume and attach it to mysql container
    • Resolve the mysql container by its name
  • To do this
git clone https://github.com/DevProjectsForDevOps/StudentCoursesRestAPI.git
cd StudentCoursesRestAPI
docker image build -t scr:latest
docker network create -d bridge scr_bridge
docker volume create scr_db
docker container run -d --name mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=test -e MYSQL_USER=directdevops -e MYSQL_PASSWORD=directdevops --network scr_bridge -v scr_db:/var/lib/mysql mysql:5.6
docker container run -d --name mypythonapp -e MYSQL_SERVER=mysql --network scr_bridge -P scr:latest

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner