SlideShare a Scribd company logo
Introduction - Docker &
Docker Compose
Docker Ahmedabad Meetup
About Me
Ketan Parmar
● Education: Ph.D Computer Science (Grid Computing)
● Experience: 10 years
● Twitter: @kpbird
● LinkedIn: https://www.linkedin.com/in/kpbird/
● Books Review:
○ Mastering AWS Development
○ Developing RESTful Web Services with Jersey 2.0
History
1. Session Based Computing
2. Non-Session Based Computing (eg. VDI or VM)
3. Containers
Why Containers?
1. Simplifying Configuration
2. Code Pipeline Management
3. Developer Productivity
4. App Isolation
5. Server Consolidation
6. Debugging Capabilities
7. And more..
VM vs Containers
Deploy
TERMINOLOGY
1. Docker client: command line that can be installed on Mac OS X or Windows to control most of the Docker
workflow and talk to Docker servers
2. Docker server: Docker running in daemon mode on a Linux server. The servers starts, runs, and stops/destroys
containers.
3. Docker images: layered filesystems described via metadata that represent all the dependencies necessary to
run an application.
4. Docker repository: the library of available Docker images, can be public (Docker Hub) or private
5. Docker container: a single instance of a Linux container built from the Docker image. There can be many
containers built from a single Docker image.
6. Docker host: the underlying Linux operating system that hosts the Docker daemon
7. Docker Hub: public repository of Docker images
8. Docker Trusted Registry: private image repository
9. Docker Toolbox: specialized installer for Docker tools on Mac and Windows
10. Docker Machine: automated Docker provisioning
11. Docker Swarm: host clustering and container scheduling
12. Docker Compose: define multi-container applications
13. Docker Registry: open source Docker image distribution
14. Docker Engine: creates and runs Docker containers
Docker Commands
● Attach Attach local standard input, output, and error streams to a running container
● Build Build an image from a Dockerfile
● Create Create a new container
● Deploy Deploy a new stack or update an existing stack
● Images List images
● Info Display system-wide information
● Kill Kill one or more running containers
● Load Load an image from a tar archive or STDIN
● Login Log in to a Docker registry
● Logout Log out from a Docker registry
● Logs Fetch the logs of a container
● Pause Pause all processes within one or more containers
● Port List port mappings or a specific mapping for the container
● Ps List containers
● Pull Pull an image or a repository from a registry
● Push Push an image or a repository to a registry
Docker Commands
● Rename Rename a container
● Restart Restart one or more containers
● Rm Remove one or more containers
● Rmi Remove one or more images
● Run Run a command in a new container
● Search Search the Docker Hub for images
● Start Start one or more stopped containers
● Stats Display a live stream of container(s) resource usage statistics
● Stop Stop one or more running containers
● Tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
● Top Display the running processes of a container
● Unpause Unpause all processes within one or more containers
● Update Update configuration of one or more containers
● Version Show the Docker version information
● Wait Block until one or more containers stop, then print their exit codes
Pull & Run Container
● docker pull nginx
● docker images
● docker run --name nginx -d -p 8080:80 nginx
● docker ps
● docker stop nginx
Build Docker Image
FROM ubuntu
MAINTAINER Ketan Parmar (ketanbparmar@yahoo.com)
RUN apt-get update
RUN apt-get install -y nginx
ENTRYPOINT [“/usr/sbin/nginx”,”-g”,”daemon off;”]
EXPOSE 80
● docker build -t mynginx:latest .
● docker images
● docker run --name mynginx -d -p 8080:80 nginx
Docker file commands
● ADD Copies a file from the host system onto the container
● CMD The command that runs when the container starts
● ENTRYPOINT
● ENV Sets an environment variable in the new container
● EXPOSE Opens a port for linked containers
● FROM The base image to use in the build. This is mandatory and must be the first command in the
file.
● MAINTAINER An optional value for the maintainer of the script
● ONBUILD A command that is triggered when the image in the Dcokerfile is used as a base for another
image
● RUN Executes a command and save the result as a new layer
● USER Sets the default user within the container
● VOLUME Creates a shared volume that can be shared among containers or by the host machine
● WORKDIR Set the default working directory for the container
Docker Compose
The answer to these questions is Docker
Compose, “a tool for defining and running
complex applications with Docker. With
Compose, you define a multi-container
application in a single file, then spin your
application up in a single command which does
everything that needs to be done to get it
running.”
Example
1 Redis container
3 Node containers
1 Nginx container
version: "3.3"
services:
nginx:
build: ./nginx
links:
- node1:node1
- node2:node2
- node3:node3
ports:
- "80:80"
node1:
build: ./node
links:
- redis
ports:
- "8080"
Docker Compose (docker-compose.yml)
node2:
build: ./node
links:
- redis
ports:
- "8080"
node3:
build: ./node
links:
- redis
ports:
- "8080"
redis:
image: redis
ports:
- "6379"
Top-level keys that define a section in the configuration file such as build, deploy, depends_on, networks, and so on, are
listed with the options that support them as sub-topics. This maps to the <key>: <option>: <value> indent structure of the
Compose file.
Services
Build
Command
Volumes
Ports
Networks
Dockerfile
ARG
Docker Compose (docker-compose.yml)
Build Build or rebuild services
Config Validate and view the Compose file
Create Create services
Down Stop and remove containers, networks, images, and volumes
Events Receive real time events from containers
Exec Execute a command in a running container
Help Get help on a command
Images List images
Kill Kill containers
Logs View output from containers
Pause Pause services
Port Print the public port for a port binding
Ps List containers
Pull Pull service images
Push Push service images
Restart Restart services
Rm Remove stopped containers
Run Run a one-off command
Scale Set number of containers for a service
Start Start services
Stop Stop services
Top Display the running processes
Unpause Unpause services
Up Create and start containers
Docker Compose CLI
Thank You

More Related Content

What's hot (20)

PDF
containerd summit - Deep Dive into containerd
Docker, Inc.
 
PPTX
Containerd - core container runtime component
Docker, Inc.
 
PDF
Docker Birthday #3 - Intro to Docker Slides
Docker, Inc.
 
PDF
Introduction to Containers - From Docker to Kubernetes and everything in between
All Things Open
 
PDF
Introduction to Containers - SQL Server and Docker
Chris Taylor
 
PDF
Developer workflow with docker
Lalatendu Mohanty
 
PPTX
Docker 101 Checonf 2016
Patrick Chanezon
 
PPTX
Docker 101 - High level introduction to docker
Dr Ganesh Iyer
 
PDF
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Open
 
PPTX
Docker Platform 1.9
Docker, Inc.
 
PDF
Introduction to docker
John Willis
 
PDF
Wordcamp Bratislava 2017 - Docker! Why?
Adam Štipák
 
PDF
Docker 101: An Introduction
POSSCON
 
PPTX
LinuxKit Update at the Moby Summit
Docker, Inc.
 
PDF
Monitoring Dell Infrastructure using Docker & Microservices
Ajeet Singh Raina
 
PDF
Docker and the Linux Kernel
Docker, Inc.
 
PDF
Docker Introduction
Robert Reiz
 
PPTX
LinuxKit: the first five months by Justin Cormack & Riyaz Faizullabhoy (Docker)
Docker, Inc.
 
PPTX
Intro to docker
Towfiqul Islam
 
PDF
Introduction to LinuxKit - Docker Bangalore Meetup
Ajeet Singh Raina
 
containerd summit - Deep Dive into containerd
Docker, Inc.
 
Containerd - core container runtime component
Docker, Inc.
 
Docker Birthday #3 - Intro to Docker Slides
Docker, Inc.
 
Introduction to Containers - From Docker to Kubernetes and everything in between
All Things Open
 
Introduction to Containers - SQL Server and Docker
Chris Taylor
 
Developer workflow with docker
Lalatendu Mohanty
 
Docker 101 Checonf 2016
Patrick Chanezon
 
Docker 101 - High level introduction to docker
Dr Ganesh Iyer
 
All Things Containers - Docker, Kubernetes, Helm, Istio, GitOps and more
All Things Open
 
Docker Platform 1.9
Docker, Inc.
 
Introduction to docker
John Willis
 
Wordcamp Bratislava 2017 - Docker! Why?
Adam Štipák
 
Docker 101: An Introduction
POSSCON
 
LinuxKit Update at the Moby Summit
Docker, Inc.
 
Monitoring Dell Infrastructure using Docker & Microservices
Ajeet Singh Raina
 
Docker and the Linux Kernel
Docker, Inc.
 
Docker Introduction
Robert Reiz
 
LinuxKit: the first five months by Justin Cormack & Riyaz Faizullabhoy (Docker)
Docker, Inc.
 
Intro to docker
Towfiqul Islam
 
Introduction to LinuxKit - Docker Bangalore Meetup
Ajeet Singh Raina
 

Similar to Introduction of Docker and Docker Compose (20)

PDF
Docker.pdf
UsamaMushtaq24
 
PPTX
Dockerizing a Symfony2 application
Roman Rodomansky
 
PPTX
Primi passi con Docker - ItalianCoders - 12-01-2021
Alessandro Mignogna
 
PDF
Introduction to Docker - Learning containerization XP conference 2016
XP Conference India
 
PPTX
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
PPSX
Docker and containers - Presentation Slides by Priyadarshini Anand
PRIYADARSHINI ANAND
 
PDF
Docker, but what it is?
Julien Maitrehenry
 
PPTX
Docker
Mutlu Okuducu
 
PDF
Docker @ Atlogys
Atlogys Technical Consulting
 
PDF
Introduction to Docker
Kuan Yen Heng
 
PPTX
Docker Introductory workshop
Runcy Oommen
 
PDF
Cloud Native Computing - Part III - Containers
Linjith Kunnon
 
PDF
Docker 101 - Intro to Docker
Adrian Otto
 
PDF
Docker From Scratch
Giacomo Vacca
 
PDF
Up and running with docker
Michelle Liu
 
PDF
Docker workshop 0507 Taichung
Paul Chao
 
PDF
手把手帶你學 Docker 入門篇
Philip Zheng
 
PPTX
Docker Starter Pack
Saeed Hajizade
 
PDF
Docker
Brian Hogan
 
PPTX
Getting Started with Docker
Geeta Vinnakota
 
Docker.pdf
UsamaMushtaq24
 
Dockerizing a Symfony2 application
Roman Rodomansky
 
Primi passi con Docker - ItalianCoders - 12-01-2021
Alessandro Mignogna
 
Introduction to Docker - Learning containerization XP conference 2016
XP Conference India
 
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
Docker and containers - Presentation Slides by Priyadarshini Anand
PRIYADARSHINI ANAND
 
Docker, but what it is?
Julien Maitrehenry
 
Introduction to Docker
Kuan Yen Heng
 
Docker Introductory workshop
Runcy Oommen
 
Cloud Native Computing - Part III - Containers
Linjith Kunnon
 
Docker 101 - Intro to Docker
Adrian Otto
 
Docker From Scratch
Giacomo Vacca
 
Up and running with docker
Michelle Liu
 
Docker workshop 0507 Taichung
Paul Chao
 
手把手帶你學 Docker 入門篇
Philip Zheng
 
Docker Starter Pack
Saeed Hajizade
 
Docker
Brian Hogan
 
Getting Started with Docker
Geeta Vinnakota
 
Ad

Recently uploaded (20)

PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Ad

Introduction of Docker and Docker Compose

  • 1. Introduction - Docker & Docker Compose Docker Ahmedabad Meetup
  • 2. About Me Ketan Parmar ● Education: Ph.D Computer Science (Grid Computing) ● Experience: 10 years ● Twitter: @kpbird ● LinkedIn: https://www.linkedin.com/in/kpbird/ ● Books Review: ○ Mastering AWS Development ○ Developing RESTful Web Services with Jersey 2.0
  • 3. History 1. Session Based Computing 2. Non-Session Based Computing (eg. VDI or VM) 3. Containers
  • 4. Why Containers? 1. Simplifying Configuration 2. Code Pipeline Management 3. Developer Productivity 4. App Isolation 5. Server Consolidation 6. Debugging Capabilities 7. And more..
  • 7. TERMINOLOGY 1. Docker client: command line that can be installed on Mac OS X or Windows to control most of the Docker workflow and talk to Docker servers 2. Docker server: Docker running in daemon mode on a Linux server. The servers starts, runs, and stops/destroys containers. 3. Docker images: layered filesystems described via metadata that represent all the dependencies necessary to run an application. 4. Docker repository: the library of available Docker images, can be public (Docker Hub) or private 5. Docker container: a single instance of a Linux container built from the Docker image. There can be many containers built from a single Docker image. 6. Docker host: the underlying Linux operating system that hosts the Docker daemon 7. Docker Hub: public repository of Docker images 8. Docker Trusted Registry: private image repository 9. Docker Toolbox: specialized installer for Docker tools on Mac and Windows 10. Docker Machine: automated Docker provisioning 11. Docker Swarm: host clustering and container scheduling 12. Docker Compose: define multi-container applications 13. Docker Registry: open source Docker image distribution 14. Docker Engine: creates and runs Docker containers
  • 8. Docker Commands ● Attach Attach local standard input, output, and error streams to a running container ● Build Build an image from a Dockerfile ● Create Create a new container ● Deploy Deploy a new stack or update an existing stack ● Images List images ● Info Display system-wide information ● Kill Kill one or more running containers ● Load Load an image from a tar archive or STDIN ● Login Log in to a Docker registry ● Logout Log out from a Docker registry ● Logs Fetch the logs of a container ● Pause Pause all processes within one or more containers ● Port List port mappings or a specific mapping for the container ● Ps List containers ● Pull Pull an image or a repository from a registry ● Push Push an image or a repository to a registry
  • 9. Docker Commands ● Rename Rename a container ● Restart Restart one or more containers ● Rm Remove one or more containers ● Rmi Remove one or more images ● Run Run a command in a new container ● Search Search the Docker Hub for images ● Start Start one or more stopped containers ● Stats Display a live stream of container(s) resource usage statistics ● Stop Stop one or more running containers ● Tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE ● Top Display the running processes of a container ● Unpause Unpause all processes within one or more containers ● Update Update configuration of one or more containers ● Version Show the Docker version information ● Wait Block until one or more containers stop, then print their exit codes
  • 10. Pull & Run Container ● docker pull nginx ● docker images ● docker run --name nginx -d -p 8080:80 nginx ● docker ps ● docker stop nginx
  • 11. Build Docker Image FROM ubuntu MAINTAINER Ketan Parmar ([email protected]) RUN apt-get update RUN apt-get install -y nginx ENTRYPOINT [“/usr/sbin/nginx”,”-g”,”daemon off;”] EXPOSE 80 ● docker build -t mynginx:latest . ● docker images ● docker run --name mynginx -d -p 8080:80 nginx
  • 12. Docker file commands ● ADD Copies a file from the host system onto the container ● CMD The command that runs when the container starts ● ENTRYPOINT ● ENV Sets an environment variable in the new container ● EXPOSE Opens a port for linked containers ● FROM The base image to use in the build. This is mandatory and must be the first command in the file. ● MAINTAINER An optional value for the maintainer of the script ● ONBUILD A command that is triggered when the image in the Dcokerfile is used as a base for another image ● RUN Executes a command and save the result as a new layer ● USER Sets the default user within the container ● VOLUME Creates a shared volume that can be shared among containers or by the host machine ● WORKDIR Set the default working directory for the container
  • 13. Docker Compose The answer to these questions is Docker Compose, “a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.” Example 1 Redis container 3 Node containers 1 Nginx container
  • 14. version: "3.3" services: nginx: build: ./nginx links: - node1:node1 - node2:node2 - node3:node3 ports: - "80:80" node1: build: ./node links: - redis ports: - "8080" Docker Compose (docker-compose.yml) node2: build: ./node links: - redis ports: - "8080" node3: build: ./node links: - redis ports: - "8080" redis: image: redis ports: - "6379"
  • 15. Top-level keys that define a section in the configuration file such as build, deploy, depends_on, networks, and so on, are listed with the options that support them as sub-topics. This maps to the <key>: <option>: <value> indent structure of the Compose file. Services Build Command Volumes Ports Networks Dockerfile ARG Docker Compose (docker-compose.yml)
  • 16. Build Build or rebuild services Config Validate and view the Compose file Create Create services Down Stop and remove containers, networks, images, and volumes Events Receive real time events from containers Exec Execute a command in a running container Help Get help on a command Images List images Kill Kill containers Logs View output from containers Pause Pause services Port Print the public port for a port binding Ps List containers Pull Pull service images Push Push service images Restart Restart services Rm Remove stopped containers Run Run a one-off command Scale Set number of containers for a service Start Start services Stop Stop services Top Display the running processes Unpause Unpause services Up Create and start containers Docker Compose CLI