0% found this document useful (0 votes)
23 views

Docker MasterClass Summary

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Docker MasterClass Summary

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

[Docker Masterclass]

Docker Master Class


Summary 07-11-2023

 Docker: 9136 companies reportedly use Docker in their tech stacks, including
Pinterest, Shopify, and Spotify.

 Docker is a Containerization tool, there are others too like Podman and CRI-O.

 Every industry needs to reprovision the OS (terminate and launch) thousands of


times, and after launching OS configuration is also required
.
 Launching the OS on base metal or using Virtualization is too time-consuming.

 Here is the solution Container (Docker) which installs the OS in less than 1
sec. It also gives the hardware facilities like RAM & CPU and configures the
OS as required. It makes deployment rapid.

 To use the docker we need the OS, we are using AWS cloud for the OS

 Launch the OS/Instance at AWS cloud:


 Login to the AWS account
[Docker Masterclass]

 Search for ec2 service

 Click on Launch Instance


[Docker Masterclass]

 Name the OS and select Amazon Machine Image like Amazon Linux

 Choose Instance type (t2.mirco is free) and the key pair can be set as the
default value so that we can log in without a key pair
[Docker Masterclass]

 And Click on the Launch Instance


[Docker Masterclass]

 OS is launched successfully, to disable the default firewall by AWS on


the launched instance, select that particular instance and select the
security section

 Click on the security Groups

 Click on the Edit Inbound Rules


[Docker Masterclass]

 Make the changes below and click on the Save rules


[Docker Masterclass]

 Connect the OS by clicking on connect


[Docker Masterclass]

 sudo su – root Command to login to the root account.

 whoami command to check which user is currently working.

 yum install docker -y Command to install the docker with the option yes.

 systemctl start docker Command to start the Docker Services.


[Docker Masterclass]

 docker ps -a command to check how many containers or OS are there.

 We can launch multiple containers or OS on the top-up Docker

 To install the OS, the minimum requirement is an OS image therefore we have


to pull an OS image from the image repository .

 docker pull (image_name) is the command to pull any image


docker pull ubuntu:14.04

 docker images command to see all images


[Docker Masterclass]

 docker run -t -i (image_name) command to launch the OS

 docker run -t -i ubuntu:14.04 (launching the ubuntu OS)

 free -m command to check the free memory space.

 docker run -d -t -i ubuntu:14.04 command to launch the container in detached


mode (in the background).

 exit command to exit from the container.

 docker attach (container_Id or container_name) command to go inside the


container.

 ifconfig command to check the IP address of the container


[Docker Masterclass]

 ctl+p+q shortcut key to exit from the container without shutting down.

 ping (ip_address) command to check the connectivity between two OS

 docker run -it --name myos1 centos:latest command to launch the OS with
custom name.

 Configuration OS as a Web Server


 yum install httpd command to install httpd server

 docker pull httpd command to use a preconfigured web server of


Apache

 docker run -dit --name webos1 httpd - launching the


preconfigured web server
[Docker Masterclass]

 docker inspect (container_name) - command to check the IP address and more


details

 curl http://172.17.0.2 command to run the webpages on CLI

 docker run -dit --name os1 -p 1234:80 httpd – giving the port number to the
container
[Docker Masterclass]

 docker pull jenkins/jenkins:lts command to pull the Jenkins image.

 docker run -dit -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts – command


to setup the Jenkins .
[Docker Masterclass]

 docker stop (container_name) – command to stop the container.


 docker rm (container_name) – command to delete the container.
 docker rm -f $(docker ps -a -q) – command to delete all the exist containers.
 docker rmi (image_name) – command to delete the image.

 Dockerfile: Dockerfile is a way to create our own images.

 Docker-compose – Docker-compose helps us in automation in the docker


containers.

 Installing Docker-Compose
 Run the given command below to install the docker-compose command
 sudo curl -L
"https://github.com/docker/compose/releases/download/v2.12.2/docker-
compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose

 yum install git - command to install the git command.

 git clone https://github.com/dockersamples/example-voting-app.git command


to download the particular project using the given URL.
[Docker Masterclass]

 cd example-voting-app/ - command to go inside this folder.

 vim docker-compose.yml – command to do the manual changes in the file.

 docker-compose up -d – command to run the code in the detached mode.

 How Netflix is getting benefits from containerization:


https://youtu.be/4OLlKGT7aVQ?si=NgMJShwJ3YdDsr4A

You might also like