Professional Documents
Culture Documents
S3 - Containerization
S3 - Containerization
GL5 2020-2021
Today’s program
1. What’s a containerization
▹ Overview
▹ History
▹ Compared to virtualization
2. What’s docker
▹ Overview
▹ Under the hood
▹ Workflow
▹ Layers
3. Install and Play with Docker
2
1
What’s
Containerization?
Containerization: Overview
4
Containerization: History
5
Containerization: Compared to
virtualization
6
Containerization: Compared to
virtualization
▸ Unlike Virtualization: No Guest OS
▹ Containers’ processes run directly on Host OS
▹ Benefits: to better performance and quicker start
▸ Like Virtualization: Runtime(Libs/Bins) are not shared
▹ Isolation is mostly uncompromised
https://www.backblaze.com/blog/vm-vs-containers/ 7
2 What’s Docker?
Docker: Overview
9
Play now,
With Docker
10
Docker: Workflow
11
Docker: Commands
▸ docker container ls ▸ List running containers
▸ -it (interactive
(interactive and
and tty,
tty, attach
attach terminal
terminal to
to the
the container
containerand
andlet
letititaccept
acceptuser
userinput)
input)
13
Dockerfile
FROM node:16 ▸ Image to start from
start from
WORKDIR /usr/src/app ▸ Working directory
directory
COPY package*.json ./ ▸ Copy from
from host
hostto
tocontainer
container
RUN npm install ▸ Running command
command on
onbuild
build
COPY . . ▸ Copy from
from host
hostto
tocontainer
container
EXPOSE 3000 ▸ Specify port to be exposed
exposed by the
the container
container when
when started
started
ENV VAR_NAME=var_value ▸ Set
Set Environment
Environmentvariables
variables
CMD
CMD [ "node", "app.js" ] ▸ Define the command
command to
to be
be run
run on
on container
container start
start
Namespaces CGroups
A way to isolate processes in Linux: A Linux built-in tool to limit resources to
▸ Mount processes and sockets:
▸ Process ID ▸ CPU
▸ Network ▸ Memory
▸ User ID ▸ Disk
▸ Priority
15
Docker: Layers (UnionFS)
16