DevOps Classroom notes 05/Oct/2024

How Docker Works ?

  • Container is an isolated space which will have its own Refer Here

    • process tree with the help of pid namespace
    • disk mounts with the help of mnt namespace
    • users with the help of usr namespace
    • network with the help of net namespace
    • CPU and RAM : with the help of cGroups
      Preview
  • Earlier Generation of Container creation incuded

    • docker engine directly interacting wiht linux kernel to create containers
      Preview
  • Docker has implemented runc to create containers
    Preview
  • OCI (Open container initiative was formed ) and the architecture of Docker has changed from monolith to layered

Port forwarding

  • Overview
    Preview
  • Let me create three applications in two containers each

    • nginx (it runs on port 80 )
    • jenkins (it runs on port 8080)
    • mysql container (it runs on port 3306)
docker container run -d --name nginx1 nginx
docker container run -d --name nginx2 nginx
docker container run -d --name jenkins1 jenkins/jenkins
docker container run -d --name jenkins2 jenkins/jenkins
docker container run -d --name mysql1 -e MYSQL_ROOT_PASSWORD=password mysql:8.0
docker container run -d --name mysql2 -e MYSQL_ROOT_PASSWORD=password mysql:8.0

Preview
* The above containers are not userful for me as i cannot access them from outside the vm.
* Delete all the containers docker container rm -f $(docker container ls -q -a)
* Delete all the image docker image rm $(docker image ls -q)
* For port forwarding we have two modes
* static -p <hostport>:<containerPort>
Preview
Preview
* Dynamic -P
Preview
* Lets apply dynamic Port forwarding

docker container run -d -P --name nginx1 nginx
docker container run -d -P --name nginx2 nginx
docker container run -d -P --name jenkins1 jenkins/jenkins
docker container run -d -P --name jenkins2 jenkins/jenkins
docker container run -d -P --name mysql1 -e MYSQL_ROOT_PASSWORD=password mysql:8.0
docker container run -d -P --name mysql2 -e MYSQL_ROOT_PASSWORD=password mysql:8.0

Preview

  • Lets connect to jenkins
    Preview
  • Lets connect to nginx
    Preview
  • Lets connect to mysql

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 Responsive Web Designing 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