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
  • Earlier Generation of Container creation incuded
    • docker engine directly interacting wiht linux kernel to create containers
  • Docker has implemented runc to create containers
  • OCI (Open container initiative was formed ) and the architecture of Docker has changed from monolith to layered

Port forwarding

  • Overview
  • 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


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


* Dynamic -P

* 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

  • Lets connect to jenkins
  • Lets connect to nginx
  • Lets connect to mysql
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%