DevOps Classroomnotes 07/Jan/2022

Install Docker on Linux

  • We need an linux instance. We will be create a linux instance in
  • AWS Cloud Refer Here
  • Azure Refer Here
  • Ubuntu:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker <username> #$USER
exit
# relogin

Preview
* Centos:

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker <username> #$USER
exit
# relogin
sudo systemctl enable docker.service
sudo systemctl start docker.service
docker info
  • The script which we have used to install docker always installs the latest stable version of docker.
  • Refer Here for the shell script used

Docker Image and Container Creation Basics

  • Lets see the list of the images in the newly installed docker
docker image ls
  • Downloading the image from registry is called as pull
  • The image name has two components <name-of-image>:<tag>
  • name of the image represents application
  • tag represents the version
  • If you dont pass the tag, docker will consider tag as latest so
  • if you have written image name as httpd == httpd:latest
  • Now lets pull the jenkins/jenkins image
docker image pull jenkins/jenkins

Preview
* Now lets look at the tags of jenkins/jenkins Refer Here
Preview
* Every image in the registry will have unique image id.
* Two different images have the same image id imply that they are same images with different names.
Preview
* Lets create a jenkins container docker container run -d <image>:<tag>


docker container run -d jenkins/jenkins
docker container ls

Preview
* To access the application inside the docker we have to do port forwarding docker container run -d -p <hostport>:<containerport> <imageid>:<tag>
Preview
Preview
* Lets try to create an apache continer
Preview
Preview
* Overview of portforwarding
Preview
* Docker can map the container port to dynamic port on the Docker Host (Linux VM) docker container run -d -P <imageid>:<tag>
Preview
Preview

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner