chroot on steroids
Linux Kernel
Proc.
FS
Mem.
CPU
Devi.
Net
cgroups / namespaces
Containers
others...
others...
Server Hardware
Host OS
Hypervisor
Guest
OS
Guest
OS
Guest
OS
Bin / Libs
Bin / Libs
Bin / Libs
App
App
App
Server Hardware
Host OS
Bin / Libs
Bin / Libs
Bin / Libs
App
App
App
Virtualization (i.e. kvm, xen) |
LXC Containers | |
---|---|---|
Footprint | Requires a hypervisor and a full operating system image. | Does not require a hypervisor or a separate operating system image. |
OS supported | Any OS supported by the hypervisor | Most Linux distros, uses same kernel as host |
Typical server deployment | 10 – 100 VMs | 100 - 1000 containers |
Boot time | Less than a minute | Seconds |
Physical resources (i.e. memory, CPU) |
Each VM has resource reserved for its own use | Shared by all containers |
Layered filesystems
# base image
FROM node:latest
# environment variable
ENV NODE_ENV development
# working directory
WORKDIR /src
# run command
RUN echo "Configuring..."
# add file
ADD ./server.js /srv/server.js
# expose port
EXPOSE 1337
# default command
CMD ["node", "/srv/server.js"]
Building a new image
Changing a image
Instances of an Image
Linux
Docker Host
Docker Client
HTTP API
Docker Server
Container
Container
Container
Container
Container
Container
Container
Container
Basic Docker Workflow