SlideShare a Scribd company logo
DOCKER
Getting Started
Created By ENG/Hussien
Elhannan
hussien.elhannan@gmail.com
Theideaof containerizationvs virtualization:
Docker Engine:
•Docker engine is the core piece of software for building images and running containers
With these major components:
Docker client : is the primary way that many Docker users interact with Docker. When
you use commands such as docker run, the client sends these commands to dockerd,
which carries them out. And also the Docker client can communicate with more than
one daemon.
Docker daemon: (dockerd) listens for Docker API requests and manages Docker objects
such as images, containers, networks, and volumes. A daemon can also communicate
with other daemons to manage Docker services.
Note : The Docker client and daemon can run on the same system, or you can connect
a Docker client to a remote Docker daemon. The Docker client and daemon
communicate using a REST API, over UNIX sockets or a network interface.
Stateless App vs Stateful app :
Stateless App:
- Doesn’t keep many data
- Forward the connection and once done it forget all about it’s done and move to the
next task
- Ex : Web Servers
Stateful App:
- Keep changes and data
- Remember your connections
- Ex : Database or key Value store (is a simple database that uses
an associative array (think of a map or dictionary)
Behind the scenes, How Docker works ?
Execution
Driver
Kernel Namespaces : allow us to partition up system name spaces like process ID tree or
usr Namespaces or networking Namespaces ,…. and assign a partition to one container
and so on
Control Groups (Cgroups) : group together resources
and apply limits like QOS rules
Container A Container B Container C
Capabilities : ability to slice privileges of a root and give one of them to a user or a
container.
LibContainer : replaced the LXC as an execution drive
Between Docker engine and kernel with it’s features
Such as NameSpaces,Cgroups and Capabilities and
Not only we have control on it in contrast with LXC
You also can ship it into the Docker Daemon
Docker Registries :
- Stores Docker images such as Docker Hub and Docker Cloud are public registries that
anyone can use (#Push, Pull), and Docker is configured to look for images on Docker
Hub by default. You can even run your own private registry. If you use Docker
Datacenter (DDC), it includes Docker Trusted Registry (DTR).
- Docker Hub contain official repositories or customized
Container Orchestration :
From Docker Inc. Perspective orchestration can be done on three products:
Tutem : official Docker Platform for deploying and managing your apps in the cloud from a
pretty UI.
Tutem
Docker Images :
Image consist of layers (sometimes called images) , The Base layer which got our root
file system (all file systems and directories required to make our container stripped
down bare minimum OS ) then layer 1 for example may be nginx and layer 2 for some
Updates
Note : 1- each layer can be shared with another container separately
2- Images ~ Stopped Containers , Containers ~ Running images.
Installing Docker :
According to the Linux Distro you will find a little different steps between every distro
So we can use this script which mainly works fine on manty distros :
# wget -qo- https://get.docker.com/ | sh
+ For CentOS : we can also use # yum install –y docker
#systemctl start docker.service
+ For Ubuntu : we can also use # apt-get install –y docker.io
# service docker.io status
Docker Images commands :
- Tag image as the latest : #docker tag Image-ID name:latest
- List images stored locally : #docker images
- Pull image : #docker Pull Image-name
- Delete image : #docker rmi name:tag
- Path of stored image from HUB : /var/lib/docker/aufs or another union mount technology/…
- save new image with changes made on it or installed apps : #docker comit Image-ID new-name
- see top process on the container : #docker Top Image-ID
- push image to specific repo : 1- #docker tag Image-ID Name
2- #docker push name(username):version
- see history of commands that created the layers of image : #docker history img
Container Commands :
- Show running container #docker ps
- Show running and Stopped container #docker ps –a
- Exit from container Shell : CTRL+P+Q
- Add user to docker group and take root privileges of the container without needing
to give every user root privileges #gpasswd -a username docker
- Run container : #docker run - -name *** –it Ubuntu /bin/bash *Note : running from
stored image or image on hub
- Start container already exist : #docker start container-name
- Remove Container #docker rm container-id
- More details about container & container PID : #docker inspect image-id
- Access container without needing SSH or being in attach mode #nsenter –m –u –n –
p –i –t PID /bin/bash OR #docker-enter short-ID OR #docker-exec –it short-ID /bin/bash
Interactive-TTY or –d
(detached mode) PID 1
Docker Networking :
Docker 0 interface : it’s created after Docker Daemon start and it’s actually a bit more than just interface
It’s actually a bridge or a virtual switch created entirely inside the Linux Kernel.
++Note : To see details about Docker 0 - First #{ apt-get install bridge-utils , yum install bridge-utils }
- Second #brctl show docker 0
- Vethx interface exist in the Docker 0 bridge and its connected
to the eth0 inside the container.
- show network config file for specific container (resolve.conf, hosts) :
#ls -l /var/lib/docker/containers/container-ID
- mapping container with specific port #docker run –d –p 5001:80 - - name=web1 image-name
- linking to containers 1- #docker run - -name=src –d img-name
2- #docker run - - name=rcvr - -link=src:ali-src
-it Ubuntu:15.04 /bin/bash
++to make sure attach the rcvr and #cat /etc/hosts
Alias or
nickname
Docker File :
* Simple format Plain-Text contains instructions to build image and can be stored
anywhere for EX : 1-
2- #docker build –t hellowworld:0.1 . If we will run the command from the
same directory having the docker file.
Note : #Docker history container-id to see history of commands executed on container from Docker file
-RUN : Build time command – adding layers to image (Ex : Install Apps)
-CMD : Run time command – run commands in container at lunch time (Ex : echo hello world)
-EntryPoint : such as CMD but it can’t be overrided with any command in #docker run ….. Unless you add
-- entrypoint …..
-ENV : used to make variable with values inside container (EX : ENV var1=ping var2=8.8.8.8)
Notes :
- when we build an image , docker daemon check the build cache If it has previous
instructions (image layers) so can build faster another image.
-Volume : central directory contain the data that needed to run from more than one
container and can be created during container lunching : #docker run –it - -v /test-vol --
name=Voltainer Ubuntu:15:04 /bin/bash
-Deleting volume : #docker rm –v container-name
-we can specify which network address range we want to use for our containers by editing
in docker file vim /etc/default/docker <<< Docker_OPTS=- -bip=150.150.0.1/24
-Every container gets its own thin layer (Writable Layer) that’s slapped there right on top of
the Read-Only image layers below it and within it all changes are made like installing and
updating applications , writing new files, config changes
Next:
1- Docker-swarm(Native-Docker-Clustering)
2- Docker-AWS-using
3- Getting-started-Kubernetes
4- Running Container Clusters with Kubernetes
5- Integrating-docker-with-DevOps-automated-workflows
Created By ENG/Hussien
Elhannan

More Related Content

PPTX
Docker intro
PPTX
What is Docker
PDF
Introduction to Docker
PDF
PPTX
Docker Basic Presentation
PDF
Intro To Docker
PDF
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
PDF
Docker Introduction
Docker intro
What is Docker
Introduction to Docker
Docker Basic Presentation
Intro To Docker
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Docker Introduction

What's hot (20)

PPTX
Containerization and Docker
PPT
presentation on Docker
PPT
Docker introduction
PDF
Dockerizing your applications - Docker workshop @Twitter
PPTX
Docker introduction for the beginners
PPTX
Docker Basics
PDF
Intro to containerization
PDF
Docker Introduction
PDF
Docker architecture-04-1
PDF
Introduction to Docker Compose | Docker Intermediate Workshop
PPTX
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
PDF
Docker 101 Workshop slides (JavaOne 2017)
PPTX
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
PDF
Docker Introduction
PPTX
Getting started with Docker
PDF
docker installation and basics
PDF
Docker and the Linux Kernel
PDF
Shipping Applications to Production in Containers with Docker
PPTX
Containers and docker
PDF
Dockerfile
Containerization and Docker
presentation on Docker
Docker introduction
Dockerizing your applications - Docker workshop @Twitter
Docker introduction for the beginners
Docker Basics
Intro to containerization
Docker Introduction
Docker architecture-04-1
Introduction to Docker Compose | Docker Intermediate Workshop
Docker Compose | Docker Compose Tutorial | Docker Tutorial For Beginners | De...
Docker 101 Workshop slides (JavaOne 2017)
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
Docker Introduction
Getting started with Docker
docker installation and basics
Docker and the Linux Kernel
Shipping Applications to Production in Containers with Docker
Containers and docker
Dockerfile
Ad

Similar to Docker (20)

PPTX
Virtualization, Containers, Docker and scalable container management services
PPTX
Powercoders · Docker · Fall 2021.pptx
PDF
Docker Essentials Workshop— Innovation Labs July 2020
PDF
Agile Brown Bag - Vagrant & Docker: Introduction
PDF
Docker Tutorial.pdf
PPTX
Docker Ecosystem on Azure
PPTX
Docker Starter Pack
PDF
Docker Intro
PPTX
Containerization using docker and its applications
PPTX
Containerization using docker and its applications
PDF
Introduction to Docker - Learning containerization XP conference 2016
PPTX
Getting Started with Docker
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
PDF
Docker, but what it is?
PDF
Docker
PDF
docker.pdf
PDF
Work shop - an introduction to the docker ecosystem
PPTX
Dockers and containers basics
PDF
Cloud Native Computing - Part III - Containers
PPTX
Docker presentation
Virtualization, Containers, Docker and scalable container management services
Powercoders · Docker · Fall 2021.pptx
Docker Essentials Workshop— Innovation Labs July 2020
Agile Brown Bag - Vagrant & Docker: Introduction
Docker Tutorial.pdf
Docker Ecosystem on Azure
Docker Starter Pack
Docker Intro
Containerization using docker and its applications
Containerization using docker and its applications
Introduction to Docker - Learning containerization XP conference 2016
Getting Started with Docker
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker, but what it is?
Docker
docker.pdf
Work shop - an introduction to the docker ecosystem
Dockers and containers basics
Cloud Native Computing - Part III - Containers
Docker presentation
Ad

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
KodekX | Application Modernization Development
PPTX
Big Data Technologies - Introduction.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
cuic standard and advanced reporting.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Review of recent advances in non-invasive hemoglobin estimation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Understanding_Digital_Forensics_Presentation.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Empathic Computing: Creating Shared Understanding
Network Security Unit 5.pdf for BCA BBA.
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KodekX | Application Modernization Development
Big Data Technologies - Introduction.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
cuic standard and advanced reporting.pdf
Per capita expenditure prediction using model stacking based on satellite ima...

Docker

  • 1. DOCKER Getting Started Created By ENG/Hussien Elhannan hussien.elhannan@gmail.com
  • 3. Docker Engine: •Docker engine is the core piece of software for building images and running containers With these major components: Docker client : is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to dockerd, which carries them out. And also the Docker client can communicate with more than one daemon. Docker daemon: (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services. Note : The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.
  • 4. Stateless App vs Stateful app : Stateless App: - Doesn’t keep many data - Forward the connection and once done it forget all about it’s done and move to the next task - Ex : Web Servers Stateful App: - Keep changes and data - Remember your connections - Ex : Database or key Value store (is a simple database that uses an associative array (think of a map or dictionary)
  • 5. Behind the scenes, How Docker works ? Execution Driver
  • 6. Kernel Namespaces : allow us to partition up system name spaces like process ID tree or usr Namespaces or networking Namespaces ,…. and assign a partition to one container and so on Control Groups (Cgroups) : group together resources and apply limits like QOS rules Container A Container B Container C
  • 7. Capabilities : ability to slice privileges of a root and give one of them to a user or a container. LibContainer : replaced the LXC as an execution drive Between Docker engine and kernel with it’s features Such as NameSpaces,Cgroups and Capabilities and Not only we have control on it in contrast with LXC You also can ship it into the Docker Daemon
  • 8. Docker Registries : - Stores Docker images such as Docker Hub and Docker Cloud are public registries that anyone can use (#Push, Pull), and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry. If you use Docker Datacenter (DDC), it includes Docker Trusted Registry (DTR). - Docker Hub contain official repositories or customized
  • 9. Container Orchestration : From Docker Inc. Perspective orchestration can be done on three products: Tutem : official Docker Platform for deploying and managing your apps in the cloud from a pretty UI. Tutem
  • 10. Docker Images : Image consist of layers (sometimes called images) , The Base layer which got our root file system (all file systems and directories required to make our container stripped down bare minimum OS ) then layer 1 for example may be nginx and layer 2 for some Updates Note : 1- each layer can be shared with another container separately 2- Images ~ Stopped Containers , Containers ~ Running images.
  • 11. Installing Docker : According to the Linux Distro you will find a little different steps between every distro So we can use this script which mainly works fine on manty distros : # wget -qo- https://get.docker.com/ | sh + For CentOS : we can also use # yum install –y docker #systemctl start docker.service + For Ubuntu : we can also use # apt-get install –y docker.io # service docker.io status
  • 12. Docker Images commands : - Tag image as the latest : #docker tag Image-ID name:latest - List images stored locally : #docker images - Pull image : #docker Pull Image-name - Delete image : #docker rmi name:tag - Path of stored image from HUB : /var/lib/docker/aufs or another union mount technology/… - save new image with changes made on it or installed apps : #docker comit Image-ID new-name - see top process on the container : #docker Top Image-ID - push image to specific repo : 1- #docker tag Image-ID Name 2- #docker push name(username):version - see history of commands that created the layers of image : #docker history img
  • 13. Container Commands : - Show running container #docker ps - Show running and Stopped container #docker ps –a - Exit from container Shell : CTRL+P+Q - Add user to docker group and take root privileges of the container without needing to give every user root privileges #gpasswd -a username docker - Run container : #docker run - -name *** –it Ubuntu /bin/bash *Note : running from stored image or image on hub - Start container already exist : #docker start container-name - Remove Container #docker rm container-id - More details about container & container PID : #docker inspect image-id - Access container without needing SSH or being in attach mode #nsenter –m –u –n – p –i –t PID /bin/bash OR #docker-enter short-ID OR #docker-exec –it short-ID /bin/bash Interactive-TTY or –d (detached mode) PID 1
  • 14. Docker Networking : Docker 0 interface : it’s created after Docker Daemon start and it’s actually a bit more than just interface It’s actually a bridge or a virtual switch created entirely inside the Linux Kernel. ++Note : To see details about Docker 0 - First #{ apt-get install bridge-utils , yum install bridge-utils } - Second #brctl show docker 0 - Vethx interface exist in the Docker 0 bridge and its connected to the eth0 inside the container. - show network config file for specific container (resolve.conf, hosts) : #ls -l /var/lib/docker/containers/container-ID - mapping container with specific port #docker run –d –p 5001:80 - - name=web1 image-name - linking to containers 1- #docker run - -name=src –d img-name 2- #docker run - - name=rcvr - -link=src:ali-src -it Ubuntu:15.04 /bin/bash ++to make sure attach the rcvr and #cat /etc/hosts Alias or nickname
  • 15. Docker File : * Simple format Plain-Text contains instructions to build image and can be stored anywhere for EX : 1- 2- #docker build –t hellowworld:0.1 . If we will run the command from the same directory having the docker file. Note : #Docker history container-id to see history of commands executed on container from Docker file -RUN : Build time command – adding layers to image (Ex : Install Apps) -CMD : Run time command – run commands in container at lunch time (Ex : echo hello world) -EntryPoint : such as CMD but it can’t be overrided with any command in #docker run ….. Unless you add -- entrypoint ….. -ENV : used to make variable with values inside container (EX : ENV var1=ping var2=8.8.8.8)
  • 16. Notes : - when we build an image , docker daemon check the build cache If it has previous instructions (image layers) so can build faster another image. -Volume : central directory contain the data that needed to run from more than one container and can be created during container lunching : #docker run –it - -v /test-vol -- name=Voltainer Ubuntu:15:04 /bin/bash -Deleting volume : #docker rm –v container-name -we can specify which network address range we want to use for our containers by editing in docker file vim /etc/default/docker <<< Docker_OPTS=- -bip=150.150.0.1/24 -Every container gets its own thin layer (Writable Layer) that’s slapped there right on top of the Read-Only image layers below it and within it all changes are made like installing and updating applications , writing new files, config changes
  • 17. Next: 1- Docker-swarm(Native-Docker-Clustering) 2- Docker-AWS-using 3- Getting-started-Kubernetes 4- Running Container Clusters with Kubernetes 5- Integrating-docker-with-DevOps-automated-workflows Created By ENG/Hussien Elhannan

Editor's Notes

  • #9: Docker Hub Link : https://hub.docker.com/