Docker Intro

Ruben Taelman
Ruben TaelmanPhD Researcher at iMinds - IDLab
An Introduction to Docker
1
Ruben Taelman - @rubensworks
imec - Ghent University
So what is Docker?
Platform for running software in isolated containers
2
So what is Docker?
Platform for running software in isolated containers
3
Traditional webserver
NGINX
PostgreSQL
Node
So what is Docker?
Platform for running software in isolated containers
4
Traditional webserver Docker webserver
NGINX
PostgreSQL
Node
NGINX
PostgreSQL
Node
So what is Docker?
Platform for running software in isolated containers
5
Traditional webserver Docker webserver
NGINX
PostgreSQL
Node
NGINX
PostgreSQL
Node
✓Linux ✓Windows ✓Mac
(Reproducible) software evaluations
Easily installable and disposable software
Running different software versions simultaneously
What to use Docker for?
6
Overview
Basics
Networks
Convenience tools
7
Overview
Basics
Networks
Convenience tools
8
Virtual machines vs containers
(Docker) containers don’t need separate OS’s, so they are more lightweight.
9
Docker workflow
10
Dockerfile Image Container
Build Run
Description of an image Built image
Available for reuse
Instantiated image
Dockerfile
Layered image descriptions
11
Debian
Node JS
LDF server
12
# Inherit from the Node 4.2.2 image
FROM node:4.2.2
# Copy the server files
ADD . /app
# Install the node module
RUN cd /app && npm install
# Expose the default port
EXPOSE 3000
# Run base binary
ENTRYPOINT ["node", "bin/ldf-server"]
# Default command
CMD ["--help"]
> cat Dockerfile
RUN Executed when the image is being built
Zero or more RUN’s per Dockerfile
Typically used for installing software
Result will be stored in image
CMD Executed when the image is being run/instantiated
Only one CMD per Dockerfile
Default command to run when starting the container
Can be overridden by user
! Difference between RUN and CMD !
13
Build image to your local repository
Building a Dockerfile to an image
14
> docker build -t <image-name> <path-to-dir>
All your available images
Your local image repository
15
> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ldf-server latest db3a7fb38cb2 10 minutes ago 683.3 MB
stuff latest do89d002jbsd 1 week ago 102.2 MB
http://hub.docker.com
Reuse existing images
16
Search the Docker hub, and download images to your local repo
Or use the command-line...
17
> docker search ubuntu
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ubuntu Ubuntu is a Debian-based Linux operating s... 4958 [OK]
ubuntu-upstart Upstart is an event-based replacement for ... 67 [OK]
rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 47 [OK]
> docker pull ubuntu
12.04: Pulling from library/ubuntu
ba2b457ecfb2: Pull complete
26180b0fe8fb: Pull complete
edd7c1974a70: Pull complete
57bca5139a13: Pull complete
library/ubuntu:12.04: The image you are pulling has been verified.
Status: Downloaded newer image for ubuntu:12.04
Instantiate an image
Running an image
18
> docker run -it --rm ldf-server
Important options:
-i
-t
--rm
-d
-p 8080:80
-v /mydir:/targetdir
...
Keep STDIN open
Allocate new terminal
Remove container after stopping (default: stopped state)
Run in background
Map host port to container port
Map local directory to container directory
List running containers
List running + stopped containers
Stop container
Remove container
List images
Remove image
Image and container management
19
docker ps
docker ps -a
docker stop <container-hash-or-name>
docker rm <container-hash-or-name>
docker images
docker rmi <image-name>
Attach an image (not guaranteed to have a CLI)
Using detached containers
20
> docker attach <container-hash>
Open shell in container (useful for debugging)
> docker exec -it <container-hash> /bin/bash
CTRL+p CTRL+q to detach
Overview
Basics
Networks
Convenience tools
21
Connect microservices
using virtual Docker networks
22
Docker webserver
NGINX
PostgreSQL
Node
Managing networks
23
> docker network ls
NETWORK ID NAME DRIVER
7fca4eb8c647 bridge bridge
9f904ee27bf5 none null
cf03ee007fb4 host host
Default
Dummy network
Same as host network
> docker network create --driver bridge <network-name>
> docker network inspect <network-name>
> docker run --network=<network-name> <image-name>
using Docker swarm
Swarm
Running containers on multiple hosts
24
Manager
Node 1Node 0 Node 2
Scale applications, by running containers N times
Load balancing
Automatic management
Deploying applications in clusters
25
Scale applications, by running containers N times
Load balancing
Automatic management
Deploying applications in clusters
26
Overview
Basics
Networks
Convenience tools
27
Docker Compose
Declaratively define multi-container applications in docker-compose.yml
28
> docker-compose up -d
> docker-compose stop
> docker-compose rm
29
version: '2'
services:
server:
image: linkeddatafragments/server.js
ports:
- "3000:3000"
volumes:
- ${DATA_DIR}:/data
- ./config-server.json:/tmp/config.json
command: /tmp/config.json 3000 ${LDF_WORKERS}
server-cache:
image: nginx:stable
ports:
- "80:80"
volumes:
- ./nginx-default:/etc/.../default:ro
links:
- server
> cat docker-compose.yml
Docker Machine
Install Docker Engine on any host
Easily SSH to any host to control it
30
Methods for measuring CPU, memory usage, I/O …
Third-party alternatives: Datadog, CAdvisor, Scout ...
Monitoring
31
> docker stats
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
1285939c1fd3 0.07% 796 KiB / 64 MiB 1.21% 788 B / 648 B 3.568 MB / 512 KB
9c76f7834ae2 0.07% 2.746 MiB / 64 MiB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
d1ea048f04e4 0.03% 4.583 MiB / 64 MiB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B
Overview
Basics
Networks
Convenience tools
32
1 of 32

Recommended

Containers: The What, Why, and How by
Containers: The What, Why, and HowContainers: The What, Why, and How
Containers: The What, Why, and HowSneha Inguva
4.9K views34 slides
An Updated Performance Comparison of Virtual Machines and Linux Containers by
An Updated Performance Comparison of Virtual Machines and Linux ContainersAn Updated Performance Comparison of Virtual Machines and Linux Containers
An Updated Performance Comparison of Virtual Machines and Linux ContainersKento Aoyama
2.4K views41 slides
Ansible docker by
Ansible dockerAnsible docker
Ansible dockerQNIB Solutions
4.6K views31 slides
Docker Architecture (v1.3) by
Docker Architecture (v1.3)Docker Architecture (v1.3)
Docker Architecture (v1.3)rajdeep
22.3K views26 slides
Docker.io by
Docker.ioDocker.io
Docker.ioLadislav Prskavec
18.3K views55 slides
Docker Distributed application bundle & Stack - Overview by
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Thomas Chacko
683 views11 slides

More Related Content

What's hot

A Gentle Introduction To Docker And All Things Containers by
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersJérôme Petazzoni
60.6K views52 slides
Docker introduction by
Docker introductionDocker introduction
Docker introductionLayne Peng
1.3K views33 slides
Docker internals by
Docker internalsDocker internals
Docker internalsRohit Jnagal
6.9K views12 slides
Docker DANS workshop by
Docker DANS workshopDocker DANS workshop
Docker DANS workshopvty
299 views24 slides
2 Linux Container and Docker by
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and DockerFabio Fumarola
8.1K views68 slides
An Introduction to Kubernetes by
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to KubernetesImesh Gunaratne
54.5K views27 slides

What's hot(20)

A Gentle Introduction To Docker And All Things Containers by Jérôme Petazzoni
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
Jérôme Petazzoni60.6K views
Docker introduction by Layne Peng
Docker introductionDocker introduction
Docker introduction
Layne Peng1.3K views
Docker DANS workshop by vty
Docker DANS workshopDocker DANS workshop
Docker DANS workshop
vty299 views
2 Linux Container and Docker by Fabio Fumarola
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and Docker
Fabio Fumarola8.1K views
An Introduction to Kubernetes by Imesh Gunaratne
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
Imesh Gunaratne54.5K views
Networking and Go: An Engineer's Journey (Strangeloop 2019) by Sneha Inguva
Networking and Go: An Engineer's Journey (Strangeloop 2019)Networking and Go: An Engineer's Journey (Strangeloop 2019)
Networking and Go: An Engineer's Journey (Strangeloop 2019)
Sneha Inguva2K views
Endocode Kubernetes Meetup: Architecture Patterns for Microservices in Kubern... by Thomas Fricke
Endocode Kubernetes Meetup: Architecture Patterns for Microservices in Kubern...Endocode Kubernetes Meetup: Architecture Patterns for Microservices in Kubern...
Endocode Kubernetes Meetup: Architecture Patterns for Microservices in Kubern...
Thomas Fricke813 views
Breaking the RpiDocker challenge by Nicolas De Loof
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge
Nicolas De Loof707 views
Docker - container and lightweight virtualization by Sim Janghoon
Docker - container and lightweight virtualization Docker - container and lightweight virtualization
Docker - container and lightweight virtualization
Sim Janghoon7.3K views
Container Orchestration from Theory to Practice by Docker, Inc.
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to Practice
Docker, Inc.1.6K views
Red Teaming macOS Environments with Hermes the Swift Messenger by Justin Bui
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift Messenger
Justin Bui734 views
Inside Docker for Fedora20/RHEL7 by Etsuji Nakai
Inside Docker for Fedora20/RHEL7Inside Docker for Fedora20/RHEL7
Inside Docker for Fedora20/RHEL7
Etsuji Nakai39.9K views
Kubernetes the deltatre way the basics - introduction to containers and orc... by Rauno De Pasquale
Kubernetes the deltatre way   the basics - introduction to containers and orc...Kubernetes the deltatre way   the basics - introduction to containers and orc...
Kubernetes the deltatre way the basics - introduction to containers and orc...
Rauno De Pasquale152 views

Viewers also liked

Jelly Shots by
Jelly ShotsJelly Shots
Jelly ShotsJosekaishy
293 views6 slides
EKAW - Triple Pattern Fragments by
EKAW - Triple Pattern FragmentsEKAW - Triple Pattern Fragments
EKAW - Triple Pattern FragmentsRuben Taelman
448 views29 slides
Continuous Self-Updating Query Results over Dynamic Linked Data by
Continuous Self-Updating Query Results over Dynamic Linked DataContinuous Self-Updating Query Results over Dynamic Linked Data
Continuous Self-Updating Query Results over Dynamic Linked DataRuben Taelman
1.1K views22 slides
Continuously Updating Query Results over Real-Time Linked Data by
Continuously Updating Query Results over Real-Time Linked DataContinuously Updating Query Results over Real-Time Linked Data
Continuously Updating Query Results over Real-Time Linked DataRuben Taelman
1.3K views21 slides
EKAW - Linked Data Publishing by
EKAW - Linked Data PublishingEKAW - Linked Data Publishing
EKAW - Linked Data PublishingRuben Taelman
433 views27 slides
PowerPoint Presentation.2015 by
PowerPoint Presentation.2015PowerPoint Presentation.2015
PowerPoint Presentation.2015Samar Kamel
336 views29 slides

Viewers also liked(18)

EKAW - Triple Pattern Fragments by Ruben Taelman
EKAW - Triple Pattern FragmentsEKAW - Triple Pattern Fragments
EKAW - Triple Pattern Fragments
Ruben Taelman448 views
Continuous Self-Updating Query Results over Dynamic Linked Data by Ruben Taelman
Continuous Self-Updating Query Results over Dynamic Linked DataContinuous Self-Updating Query Results over Dynamic Linked Data
Continuous Self-Updating Query Results over Dynamic Linked Data
Ruben Taelman1.1K views
Continuously Updating Query Results over Real-Time Linked Data by Ruben Taelman
Continuously Updating Query Results over Real-Time Linked DataContinuously Updating Query Results over Real-Time Linked Data
Continuously Updating Query Results over Real-Time Linked Data
Ruben Taelman1.3K views
EKAW - Linked Data Publishing by Ruben Taelman
EKAW - Linked Data PublishingEKAW - Linked Data Publishing
EKAW - Linked Data Publishing
Ruben Taelman433 views
PowerPoint Presentation.2015 by Samar Kamel
PowerPoint Presentation.2015PowerPoint Presentation.2015
PowerPoint Presentation.2015
Samar Kamel336 views
The Demon Final by JamesElam
The Demon FinalThe Demon Final
The Demon Final
JamesElam150 views
Kent English Profile by Rex Kent Liu
Kent English ProfileKent English Profile
Kent English Profile
Rex Kent Liu315 views
Tienda motor store by Amaiitaa
Tienda motor storeTienda motor store
Tienda motor store
Amaiitaa201 views
Camera Angles by JamesElam
Camera AnglesCamera Angles
Camera Angles
JamesElam215 views
Docker Demystified - Virtual VMs without the Fat by Erik Osterman
Docker Demystified - Virtual VMs without the FatDocker Demystified - Virtual VMs without the Fat
Docker Demystified - Virtual VMs without the Fat
Erik Osterman1.4K views
Penguat transistor by mz_khamim
Penguat transistorPenguat transistor
Penguat transistor
mz_khamim320 views
Docker from basics to orchestration (PHPConfBr2015) by Wellington Silva
Docker from basics to orchestration (PHPConfBr2015)Docker from basics to orchestration (PHPConfBr2015)
Docker from basics to orchestration (PHPConfBr2015)
Wellington Silva786 views
Trade commodity finance and its services by Rusca Dimitri
Trade commodity finance and its servicesTrade commodity finance and its services
Trade commodity finance and its services
Rusca Dimitri418 views

Similar to Docker Intro

Powercoders · Docker · Fall 2021.pptx by
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
8 views68 slides
Introducing Docker by
Introducing DockerIntroducing Docker
Introducing DockerFrancesco Pantano
461 views30 slides
How to _docker by
How to _dockerHow to _docker
How to _dockerAbdur Rab Marjan
91 views24 slides
Docker Introduction by
Docker IntroductionDocker Introduction
Docker IntroductionMANAOUIL Karim
329 views15 slides
Docker for Web Developers: A Sneak Peek by
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peekmsyukor
873 views28 slides
Docking with Docker by
Docking with DockerDocking with Docker
Docking with DockerUniversity of Alabama at Birmingham
240 views33 slides

Similar to Docker Intro(20)

Powercoders · Docker · Fall 2021.pptx by IgnacioTamayo2
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo28 views
Docker for Web Developers: A Sneak Peek by msyukor
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
msyukor873 views
Docker - The Linux Container by Balaji Rajan
Docker - The Linux ContainerDocker - The Linux Container
Docker - The Linux Container
Balaji Rajan13.5K views
Introduction of Docker and Docker Compose by Dr. Ketan Parmar
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
Dr. Ketan Parmar393 views
Running Docker in Development & Production (DevSum 2015) by Ben Hall
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
Ben Hall9.3K views
Docker HK Meetup - 201707 by Clarence Ho
Docker HK Meetup - 201707Docker HK Meetup - 201707
Docker HK Meetup - 201707
Clarence Ho995 views
Docker: A New Way to Turbocharging Your Apps Development by msyukor
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
msyukor862 views
廣宣學堂: 容器進階實務 - Docker進深研究班 by Paul Chao
廣宣學堂: 容器進階實務 - Docker進深研究班廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班
Paul Chao453 views
Docker 進階實務班 by Philip Zheng
Docker 進階實務班Docker 進階實務班
Docker 進階實務班
Philip Zheng1.1K views

More from Ruben Taelman

Poster Demonstration of Comunica, a Web framework for querying heterogeneous ... by
Poster Demonstration of Comunica, a Web framework for querying heterogeneous ...Poster Demonstration of Comunica, a Web framework for querying heterogeneous ...
Poster Demonstration of Comunica, a Web framework for querying heterogeneous ...Ruben Taelman
230 views1 slide
Poster GraphQL-LD: Linked Data Querying with GraphQL by
Poster GraphQL-LD: Linked Data Querying with GraphQLPoster GraphQL-LD: Linked Data Querying with GraphQL
Poster GraphQL-LD: Linked Data Querying with GraphQLRuben Taelman
263 views1 slide
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIs by
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIsPoster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIsRuben Taelman
287 views1 slide
Components.js by
Components.jsComponents.js
Components.jsRuben Taelman
510 views20 slides
Versioned Triple Pattern Fragments by
Versioned Triple Pattern FragmentsVersioned Triple Pattern Fragments
Versioned Triple Pattern FragmentsRuben Taelman
331 views1 slide
Versioned Triple Pattern Fragments by
Versioned Triple Pattern FragmentsVersioned Triple Pattern Fragments
Versioned Triple Pattern FragmentsRuben Taelman
933 views31 slides

More from Ruben Taelman(13)

Poster Demonstration of Comunica, a Web framework for querying heterogeneous ... by Ruben Taelman
Poster Demonstration of Comunica, a Web framework for querying heterogeneous ...Poster Demonstration of Comunica, a Web framework for querying heterogeneous ...
Poster Demonstration of Comunica, a Web framework for querying heterogeneous ...
Ruben Taelman230 views
Poster GraphQL-LD: Linked Data Querying with GraphQL by Ruben Taelman
Poster GraphQL-LD: Linked Data Querying with GraphQLPoster GraphQL-LD: Linked Data Querying with GraphQL
Poster GraphQL-LD: Linked Data Querying with GraphQL
Ruben Taelman263 views
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIs by Ruben Taelman
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIsPoster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Poster Declaratively Describing Responses of Hypermedia-Driven Web APIs
Ruben Taelman287 views
Versioned Triple Pattern Fragments by Ruben Taelman
Versioned Triple Pattern FragmentsVersioned Triple Pattern Fragments
Versioned Triple Pattern Fragments
Ruben Taelman331 views
Versioned Triple Pattern Fragments by Ruben Taelman
Versioned Triple Pattern FragmentsVersioned Triple Pattern Fragments
Versioned Triple Pattern Fragments
Ruben Taelman933 views
PoDiGG: Public Transport Dataset Generator based on Population Distributions by Ruben Taelman
PoDiGG: Public Transport Dataset Generator based on Population DistributionsPoDiGG: Public Transport Dataset Generator based on Population Distributions
PoDiGG: Public Transport Dataset Generator based on Population Distributions
Ruben Taelman317 views
Exposing RDF Archives using Triple Pattern Fragments by Ruben Taelman
Exposing RDF Archives using Triple Pattern FragmentsExposing RDF Archives using Triple Pattern Fragments
Exposing RDF Archives using Triple Pattern Fragments
Ruben Taelman306 views
EKAW - Publishing with Triple Pattern Fragments by Ruben Taelman
EKAW - Publishing with Triple Pattern FragmentsEKAW - Publishing with Triple Pattern Fragments
EKAW - Publishing with Triple Pattern Fragments
Ruben Taelman425 views
Multidimensional Interfaces for Selecting Data with Order by Ruben Taelman
Multidimensional Interfaces for Selecting Data with OrderMultidimensional Interfaces for Selecting Data with Order
Multidimensional Interfaces for Selecting Data with Order
Ruben Taelman959 views
Scalable Dynamic Data Consumption on the Web by Ruben Taelman
Scalable Dynamic Data Consumption on the WebScalable Dynamic Data Consumption on the Web
Scalable Dynamic Data Consumption on the Web
Ruben Taelman331 views
Moving RDF Stream Processing to the Client by Ruben Taelman
Moving RDF Stream Processing to the ClientMoving RDF Stream Processing to the Client
Moving RDF Stream Processing to the Client
Ruben Taelman350 views
Querying Dynamic Datasources with Continuously Mapped Sensor Data by Ruben Taelman
Querying Dynamic Datasources with Continuously Mapped Sensor DataQuerying Dynamic Datasources with Continuously Mapped Sensor Data
Querying Dynamic Datasources with Continuously Mapped Sensor Data
Ruben Taelman565 views

Recently uploaded

Education and Diversity.pptx by
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptxDrHafizKosar
177 views16 slides
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx by
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxMs. Pooja Bhandare
93 views51 slides
11.28.23 Social Capital and Social Exclusion.pptx by
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptxmary850239
304 views25 slides
The basics - information, data, technology and systems.pdf by
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdfJonathanCovena1
126 views1 slide
MIXING OF PHARMACEUTICALS.pptx by
MIXING OF PHARMACEUTICALS.pptxMIXING OF PHARMACEUTICALS.pptx
MIXING OF PHARMACEUTICALS.pptxAnupkumar Sharma
82 views35 slides
The Value and Role of Media and Information Literacy in the Information Age a... by
The Value and Role of Media and Information Literacy in the Information Age a...The Value and Role of Media and Information Literacy in the Information Age a...
The Value and Role of Media and Information Literacy in the Information Age a...Naseej Academy أكاديمية نسيج
54 views42 slides

Recently uploaded(20)

Education and Diversity.pptx by DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar177 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx by Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
11.28.23 Social Capital and Social Exclusion.pptx by mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239304 views
The basics - information, data, technology and systems.pdf by JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1126 views
Psychology KS4 by WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch90 views
Monthly Information Session for MV Asterix (November) by Esquimalt MFRC
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)
Esquimalt MFRC58 views
Use of Probiotics in Aquaculture.pptx by AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL104 views
The Accursed House by Émile Gaboriau by DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta212 views
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant... by Ms. Pooja Bhandare
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Ms. Pooja Bhandare109 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB... by Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
7 NOVEL DRUG DELIVERY SYSTEM.pptx by Sachin Nitave
7 NOVEL DRUG DELIVERY SYSTEM.pptx7 NOVEL DRUG DELIVERY SYSTEM.pptx
7 NOVEL DRUG DELIVERY SYSTEM.pptx
Sachin Nitave61 views
REPRESENTATION - GAUNTLET.pptx by iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood107 views
Structure and Functions of Cell.pdf by Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan701 views
When Sex Gets Complicated: Porn, Affairs, & Cybersex by Marlene Maheu
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & Cybersex
Marlene Maheu73 views
Solar System and Galaxies.pptx by DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar94 views

Docker Intro

  • 1. An Introduction to Docker 1 Ruben Taelman - @rubensworks imec - Ghent University
  • 2. So what is Docker? Platform for running software in isolated containers 2
  • 3. So what is Docker? Platform for running software in isolated containers 3 Traditional webserver NGINX PostgreSQL Node
  • 4. So what is Docker? Platform for running software in isolated containers 4 Traditional webserver Docker webserver NGINX PostgreSQL Node NGINX PostgreSQL Node
  • 5. So what is Docker? Platform for running software in isolated containers 5 Traditional webserver Docker webserver NGINX PostgreSQL Node NGINX PostgreSQL Node ✓Linux ✓Windows ✓Mac
  • 6. (Reproducible) software evaluations Easily installable and disposable software Running different software versions simultaneously What to use Docker for? 6
  • 9. Virtual machines vs containers (Docker) containers don’t need separate OS’s, so they are more lightweight. 9
  • 10. Docker workflow 10 Dockerfile Image Container Build Run Description of an image Built image Available for reuse Instantiated image
  • 12. 12 # Inherit from the Node 4.2.2 image FROM node:4.2.2 # Copy the server files ADD . /app # Install the node module RUN cd /app && npm install # Expose the default port EXPOSE 3000 # Run base binary ENTRYPOINT ["node", "bin/ldf-server"] # Default command CMD ["--help"] > cat Dockerfile
  • 13. RUN Executed when the image is being built Zero or more RUN’s per Dockerfile Typically used for installing software Result will be stored in image CMD Executed when the image is being run/instantiated Only one CMD per Dockerfile Default command to run when starting the container Can be overridden by user ! Difference between RUN and CMD ! 13
  • 14. Build image to your local repository Building a Dockerfile to an image 14 > docker build -t <image-name> <path-to-dir>
  • 15. All your available images Your local image repository 15 > docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ldf-server latest db3a7fb38cb2 10 minutes ago 683.3 MB stuff latest do89d002jbsd 1 week ago 102.2 MB
  • 17. Search the Docker hub, and download images to your local repo Or use the command-line... 17 > docker search ubuntu NAME DESCRIPTION STARS OFFICIAL AUTOMATED ubuntu Ubuntu is a Debian-based Linux operating s... 4958 [OK] ubuntu-upstart Upstart is an event-based replacement for ... 67 [OK] rastasheep/ubuntu-sshd Dockerized SSH service, built on top of of... 47 [OK] > docker pull ubuntu 12.04: Pulling from library/ubuntu ba2b457ecfb2: Pull complete 26180b0fe8fb: Pull complete edd7c1974a70: Pull complete 57bca5139a13: Pull complete library/ubuntu:12.04: The image you are pulling has been verified. Status: Downloaded newer image for ubuntu:12.04
  • 18. Instantiate an image Running an image 18 > docker run -it --rm ldf-server Important options: -i -t --rm -d -p 8080:80 -v /mydir:/targetdir ... Keep STDIN open Allocate new terminal Remove container after stopping (default: stopped state) Run in background Map host port to container port Map local directory to container directory
  • 19. List running containers List running + stopped containers Stop container Remove container List images Remove image Image and container management 19 docker ps docker ps -a docker stop <container-hash-or-name> docker rm <container-hash-or-name> docker images docker rmi <image-name>
  • 20. Attach an image (not guaranteed to have a CLI) Using detached containers 20 > docker attach <container-hash> Open shell in container (useful for debugging) > docker exec -it <container-hash> /bin/bash CTRL+p CTRL+q to detach
  • 22. Connect microservices using virtual Docker networks 22 Docker webserver NGINX PostgreSQL Node
  • 23. Managing networks 23 > docker network ls NETWORK ID NAME DRIVER 7fca4eb8c647 bridge bridge 9f904ee27bf5 none null cf03ee007fb4 host host Default Dummy network Same as host network > docker network create --driver bridge <network-name> > docker network inspect <network-name> > docker run --network=<network-name> <image-name>
  • 24. using Docker swarm Swarm Running containers on multiple hosts 24 Manager Node 1Node 0 Node 2
  • 25. Scale applications, by running containers N times Load balancing Automatic management Deploying applications in clusters 25
  • 26. Scale applications, by running containers N times Load balancing Automatic management Deploying applications in clusters 26
  • 28. Docker Compose Declaratively define multi-container applications in docker-compose.yml 28 > docker-compose up -d > docker-compose stop > docker-compose rm
  • 29. 29 version: '2' services: server: image: linkeddatafragments/server.js ports: - "3000:3000" volumes: - ${DATA_DIR}:/data - ./config-server.json:/tmp/config.json command: /tmp/config.json 3000 ${LDF_WORKERS} server-cache: image: nginx:stable ports: - "80:80" volumes: - ./nginx-default:/etc/.../default:ro links: - server > cat docker-compose.yml
  • 30. Docker Machine Install Docker Engine on any host Easily SSH to any host to control it 30
  • 31. Methods for measuring CPU, memory usage, I/O … Third-party alternatives: Datadog, CAdvisor, Scout ... Monitoring 31 > docker stats CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O 1285939c1fd3 0.07% 796 KiB / 64 MiB 1.21% 788 B / 648 B 3.568 MB / 512 KB 9c76f7834ae2 0.07% 2.746 MiB / 64 MiB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B d1ea048f04e4 0.03% 4.583 MiB / 64 MiB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B