Docker Container
Docker Container
Section 2: Section 4:
App A App
A
D o c ke r Doc ker
Image Container
E x a m p l e : Ubuntu with C re a t e d b y us i n g a n i ma ge.
N ode. j s a n d Ru n s your
application.
A p pl i c a t i o n C o d e
Docker containers are NOT VMs
Easy connection to make
Fundamentally different architectures
Fundamentally different benefits
Maquina Contenedor
Virtual es
7
Docker Containers Versus Virtual
Machines
App 1 App 2
B i ns/ Li bs B i ns/ Li b s
App 1 App 2
Guest O S Guest O S
B i ns / Li bs B i n s/ Li bs
Hy pe r vi so r D o c ke r E n g i n e
Virtual D o c ke r
Machines Contai ners
• Light weight , open, secure platform
S im plif y building, shipping, running
W h a t Is apps
D o c ke r ?
• R u n s natively o n L i n u x or W i n d o w s
S e rver
• R u n s on W i n d o w s or Mac
D e v e l o p m e n t machine s (with a
virtual m achine)
• Relies on " i m a g e s " a n d "containers"
Using Docker: Build, Ship, Run Workflow
Developers IT Operations
10
Some Docker vocabulary
Docker Image
The basis of a Docker container. Represents a full application
Docker Container
The standard unit in which the application service resides and executes
Docker Engine
Creates, ships and runs Docker containers deployable on a physical or
virtual, host locally, in a datacenter or cloud service provider
$ docker image ls
$ docker container run –d –p 5000:5000 –-name node node:latest
$ docker container ps
$ docker --help
Dockerfile – Linux Example
Instructions on
how to build a
Docker image
• Important to
optimize your
Dockerfile
14
Section 2:
Anatomy of a Docker Container
Docker Volumes
Volume Use Cases
Let’s Go Back to Our Dockerfile
15
Each Dockerfile Command Creates a Layer
…
EXPOSE
COPY
WORKDIR
RUN
FROM
Kernel
16
Docker Image Pull: Pulls Layers
17
Docker Volumes
Volumes mount a directory on the host into the container at a specific location
18
Why Use Volumes
Mount local source code into a running container
• Improve performance
− As directory structures get complicated traversing the tree can slow system
performance
• Data persistence
19
Section 3:
Networking
What is Docker Bridge Networking
Docker host Docker host
21
Docker Bridge Networking and Port Mapping
Docker host 1
Host port Container port
Cntnr1
10.0.0.8 :80
$ docker container run -p 8080:80 ...
Bridge
172.14.3.55 :8080
22
Section 4:
Docker Compose
Docker Compose: Multi Container Applications
Build and run one container at a time Define multi container app in compose.yml
Manually connect containers together file
Must be careful with dependencies and Single command to deploy entire app
start up order Handles container dependencies
Works with Docker Swarm, Networking,
Volumes, Universal Control Plane
49
Docker Compose: Multi Container Applications