SlideShare a Scribd company logo
DOCKER
DOCKER
● Docker the container runtime and orchestration technology.
● Docker an open source project (this is now called Moby), generated the most
interest in container technology in the past few years.
● A command line tool that made creating and working with containers easy for
developers and administrators.
● Docker is software that runs on Windows and Linux.
● It creates, manages and orchestrate containers.
Containers VS VM:
CONTAINERS VS VM
● Each virtual machine runs a unique guest operating system
● Each VM has its own binaries, libraries, and applications
● Container systems usually provide service isolation between containers.
● Containers provide a way to run these isolated systems on a single server or
host OS.
● Containers sit on top of a physical server and its host OS. Containers are only
megabytes in size and take just seconds to start, not like VM.
INTRODUCTION TO CONTAINERS
● Container technology, also known as just a container, is a method to
package an application.
● Any application can be bundled in a container can run without any worries
about dependencies, libraries and binaries.
● Container creates the isolated environment with all the required
dependencies, libraries and binaries to run your application without any issue.
● The application can run in any environment.
INTRODUCTION TO CONTAINERS
● A container is a standard unit of software that packages up a given code and
all its dependencies so the application runs quickly and reliably from one
computing environment to another.
● Containerization is a lightweight alternative to a virtual machine that involves
encapsulating an application in a container with its own operating system.
● Containerization is the process of bundling your application code with requires
packages/libraries required at runtime to execute your application quickly and
reliably in any supported computing environment
INTRODUCTION TO CONTAINERS
Monolithic applications are proved to be hard maintained, maintaining and CI/CD of
such applications is time and energy intensive.
Containerization offers the following benefits:
● Portability of distributed applications
● Reproducibility of the application
● Scaling based on requirements
● Lifecycle management of containers
● Memory, CPU, and storage efficiency compared to VM hosting and hence cluster
improvisation
Visualizing Docker’s Architecture
Visualizing Docker’s Architecture
● The Docker Daemon
○ Docker daemon is a service that runs on your host operating system.
● Docker Daemon REST API
○ The Docker daemon itself exposes a REST API From here, a number of
different tools can talk to the daemon through this API.
● Docker CLI
○ The most widespread tool is the Docker CLI. It is a command line tool
that lets you talk to the Docker daemon. When you install Docker, you get
both the Docker daemon and the Docker CLI tools together.
Images
● A Docker image is an object that contains an OS file system and an
application.
● A container image is an inert, immutable, file that’s essentially a binary
packaged snapshot of a container.
● An image is the application we want to run.
● It is like a virtual machine template.
● You can think of an image as a class.
Docker Installation
● Official Ubuntu Repositories
○ $ sudo apt-get install docker.io
● Another Way TO install Docker from Official Site
○ https://docs.docker.com/install/linux/docker-ce/ubuntu/
● Verify the installation
○ $ sudo docker -v
DOCKER
● Verify that Docker CE is installed correctly by running the hello-world
image.
○ $ sudo docker run hello-world
● CHECK IMAGES:
○ $ sudo docker image ls
○ $ sudo docker images
DOCKER COMMANDS`
● docker image pull ubuntu:latest
● docker images or docker image ls
● docker container run -it ubuntu:latest
● ps -elf
● touch myfile.txt
● pressed Ctrl-PQ
● docker container ls (copy the container name)
● docker exec -it <container-name> bash
● Stop the container and kill it using the docker container stop and docker
container rm commands.
○ docker container stop <container-name>
○ docker stop $(docker ps -a -q)
○ docker container start <container-name>
○ docker container rm <container-name>
● Verify that the container was successfully deleted by running another docker
container ls command.
○ docker container ls
DOCKER COMMANDS
To Build Docker Image:
Create index.html file
Hello EveryOne.
To Build Docker Image:
● Create Dockerfile
○ Add the following Instructions in Dockerfile:
○ FROM instruction to set the application's base image.
■ FROM nginx:alpine
○ COPY files from a specific location into a Docker image.
■ COPY index.html /usr/share/nginx/html/index.html
To Build Docker Image:
● BUILD IMAGE:
○ The "-t" flag adds a tag to the image so that it gets a nice name and tag.
○ At the end in the below command “.” which tells Docker to use the
Dockerfile in the current directory.
● docker image build -t <image-name> .
DOCKER
● CHECK IMAGES AGAIN:
○ $ sudo docker image ls
● Run IMAGE:
○ Get Image Name from above command.
■ $ sudo docker container run -p=8080:80 <image-name>
○ To run the container in the background
■ $ sudo docker container run -d --name <container-name> -p=8080:80 <image>
DOCKER-HUB
● Create account on Docker-hub.
○ https://hub.docker.com/
● Login to docker hub.
● Now connect your machine to docker hub using this command:
○ $ sudo docker login --username=yourhubusername --email=youremail@company.com
● Create repository on docker hub.
DOCKER-HUB
● Check the image ID using:
○ $ sudo docker images
● Tag your image using:
○ $ sudo docker tag <image-id> yourhubusername/repository-name:tag
● Push your image to the repository you created.
○ $ sudo docker push yourhubusername/repository-name:tag
DOCKER COMMANDS
● docker image ls
○ To get the list of images
● docker pull
○ Pull an image from the registry.
○ docker pull <image-name>
● docker run
○ docker run command to launch a container.
DOCKER COMMANDS
docker container run -it --name os1 ubuntu:latest bash
exit
docker exec -it os1 bash
docker start os1
docker exec -it os1 bash
docker volume create <volume-name>
docker volume ls
docker run -d -p 84:80 -v <vol-name>/:/usr/share/nginx/html/ 22061996/hello-world:v5
DOCKER Volume
docker run -d -p=8080:80 -v prac:/usr/share/nginx/html --name prac
22061996/hello-world:v5
THANKS

More Related Content

Similar to DOCKER-PIAIC-SLIDES

Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Pubudu Jayawardana
 
Docker
DockerDocker
Docker Basics
Docker BasicsDocker Basics
Docker Basics
ParagKhalas
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
JasonStraughan1
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
GDSC UofT Mississauga
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
Justyna Ilczuk
 
Lecture eight to be introduced in class.
Lecture eight to be introduced in class.Lecture eight to be introduced in class.
Lecture eight to be introduced in class.
nigamsajal14
 
docker.pdf
docker.pdfdocker.pdf
docker.pdf
EishaTirRaazia1
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
Cesar Maciel
 
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete MeetupIntroducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Alexandra Karapidaki
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdf
Abid Malik
 
Docker introduction - Part 1
Docker introduction - Part 1Docker introduction - Part 1
Docker introduction - Part 1
Alessandro Mignogna
 
Containers + Docker workshop - part 2
Containers + Docker workshop - part 2Containers + Docker workshop - part 2
Containers + Docker workshop - part 2
Davide Pelosi
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
Anvay Patil
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ElasTest Project
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
msyukor
 
Docker Container Introduction
Docker Container IntroductionDocker Container Introduction
Docker Container Introduction
Innfinision Cloud and BigData Solutions
 
Introduction To Docker
Introduction To  DockerIntroduction To  Docker
Introduction To Docker
Dr. Syed Hassan Amin
 

Similar to DOCKER-PIAIC-SLIDES (20)

Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker
DockerDocker
Docker
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
Docker workshop GDSC_CSSC
Docker workshop GDSC_CSSCDocker workshop GDSC_CSSC
Docker workshop GDSC_CSSC
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Lecture eight to be introduced in class.
Lecture eight to be introduced in class.Lecture eight to be introduced in class.
Lecture eight to be introduced in class.
 
docker.pdf
docker.pdfdocker.pdf
docker.pdf
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
 
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete MeetupIntroducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
 
Magento Docker Setup.pdf
Magento Docker Setup.pdfMagento Docker Setup.pdf
Magento Docker Setup.pdf
 
Docker introduction - Part 1
Docker introduction - Part 1Docker introduction - Part 1
Docker introduction - Part 1
 
Containers + Docker workshop - part 2
Containers + Docker workshop - part 2Containers + Docker workshop - part 2
Containers + Docker workshop - part 2
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Docker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps DevelopmentDocker: A New Way to Turbocharging Your Apps Development
Docker: A New Way to Turbocharging Your Apps Development
 
Docker Container Introduction
Docker Container IntroductionDocker Container Introduction
Docker Container Introduction
 
Introduction To Docker
Introduction To  DockerIntroduction To  Docker
Introduction To Docker
 

Recently uploaded

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 

Recently uploaded (20)

Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 

DOCKER-PIAIC-SLIDES

  • 2. DOCKER ● Docker the container runtime and orchestration technology. ● Docker an open source project (this is now called Moby), generated the most interest in container technology in the past few years. ● A command line tool that made creating and working with containers easy for developers and administrators. ● Docker is software that runs on Windows and Linux. ● It creates, manages and orchestrate containers.
  • 4. CONTAINERS VS VM ● Each virtual machine runs a unique guest operating system ● Each VM has its own binaries, libraries, and applications ● Container systems usually provide service isolation between containers. ● Containers provide a way to run these isolated systems on a single server or host OS. ● Containers sit on top of a physical server and its host OS. Containers are only megabytes in size and take just seconds to start, not like VM.
  • 5. INTRODUCTION TO CONTAINERS ● Container technology, also known as just a container, is a method to package an application. ● Any application can be bundled in a container can run without any worries about dependencies, libraries and binaries. ● Container creates the isolated environment with all the required dependencies, libraries and binaries to run your application without any issue. ● The application can run in any environment.
  • 6. INTRODUCTION TO CONTAINERS ● A container is a standard unit of software that packages up a given code and all its dependencies so the application runs quickly and reliably from one computing environment to another. ● Containerization is a lightweight alternative to a virtual machine that involves encapsulating an application in a container with its own operating system. ● Containerization is the process of bundling your application code with requires packages/libraries required at runtime to execute your application quickly and reliably in any supported computing environment
  • 7. INTRODUCTION TO CONTAINERS Monolithic applications are proved to be hard maintained, maintaining and CI/CD of such applications is time and energy intensive. Containerization offers the following benefits: ● Portability of distributed applications ● Reproducibility of the application ● Scaling based on requirements ● Lifecycle management of containers ● Memory, CPU, and storage efficiency compared to VM hosting and hence cluster improvisation
  • 9. Visualizing Docker’s Architecture ● The Docker Daemon ○ Docker daemon is a service that runs on your host operating system. ● Docker Daemon REST API ○ The Docker daemon itself exposes a REST API From here, a number of different tools can talk to the daemon through this API. ● Docker CLI ○ The most widespread tool is the Docker CLI. It is a command line tool that lets you talk to the Docker daemon. When you install Docker, you get both the Docker daemon and the Docker CLI tools together.
  • 10. Images ● A Docker image is an object that contains an OS file system and an application. ● A container image is an inert, immutable, file that’s essentially a binary packaged snapshot of a container. ● An image is the application we want to run. ● It is like a virtual machine template. ● You can think of an image as a class.
  • 11. Docker Installation ● Official Ubuntu Repositories ○ $ sudo apt-get install docker.io ● Another Way TO install Docker from Official Site ○ https://docs.docker.com/install/linux/docker-ce/ubuntu/ ● Verify the installation ○ $ sudo docker -v
  • 12. DOCKER ● Verify that Docker CE is installed correctly by running the hello-world image. ○ $ sudo docker run hello-world ● CHECK IMAGES: ○ $ sudo docker image ls ○ $ sudo docker images
  • 13. DOCKER COMMANDS` ● docker image pull ubuntu:latest ● docker images or docker image ls ● docker container run -it ubuntu:latest ● ps -elf ● touch myfile.txt ● pressed Ctrl-PQ ● docker container ls (copy the container name) ● docker exec -it <container-name> bash
  • 14. ● Stop the container and kill it using the docker container stop and docker container rm commands. ○ docker container stop <container-name> ○ docker stop $(docker ps -a -q) ○ docker container start <container-name> ○ docker container rm <container-name> ● Verify that the container was successfully deleted by running another docker container ls command. ○ docker container ls DOCKER COMMANDS
  • 15. To Build Docker Image: Create index.html file Hello EveryOne.
  • 16. To Build Docker Image: ● Create Dockerfile ○ Add the following Instructions in Dockerfile: ○ FROM instruction to set the application's base image. ■ FROM nginx:alpine ○ COPY files from a specific location into a Docker image. ■ COPY index.html /usr/share/nginx/html/index.html
  • 17. To Build Docker Image: ● BUILD IMAGE: ○ The "-t" flag adds a tag to the image so that it gets a nice name and tag. ○ At the end in the below command “.” which tells Docker to use the Dockerfile in the current directory. ● docker image build -t <image-name> .
  • 18. DOCKER ● CHECK IMAGES AGAIN: ○ $ sudo docker image ls ● Run IMAGE: ○ Get Image Name from above command. ■ $ sudo docker container run -p=8080:80 <image-name> ○ To run the container in the background ■ $ sudo docker container run -d --name <container-name> -p=8080:80 <image>
  • 19. DOCKER-HUB ● Create account on Docker-hub. ○ https://hub.docker.com/ ● Login to docker hub. ● Now connect your machine to docker hub using this command: ○ $ sudo docker login --username=yourhubusername --email=youremail@company.com ● Create repository on docker hub.
  • 20. DOCKER-HUB ● Check the image ID using: ○ $ sudo docker images ● Tag your image using: ○ $ sudo docker tag <image-id> yourhubusername/repository-name:tag ● Push your image to the repository you created. ○ $ sudo docker push yourhubusername/repository-name:tag
  • 21. DOCKER COMMANDS ● docker image ls ○ To get the list of images ● docker pull ○ Pull an image from the registry. ○ docker pull <image-name> ● docker run ○ docker run command to launch a container.
  • 22. DOCKER COMMANDS docker container run -it --name os1 ubuntu:latest bash exit docker exec -it os1 bash docker start os1 docker exec -it os1 bash docker volume create <volume-name> docker volume ls docker run -d -p 84:80 -v <vol-name>/:/usr/share/nginx/html/ 22061996/hello-world:v5
  • 23. DOCKER Volume docker run -d -p=8080:80 -v prac:/usr/share/nginx/html --name prac 22061996/hello-world:v5