Docker Tutorial
ECE 568: Engineering Robust Server Software
What is Docker?
Docker is a tool that makes it easier to create, run and deploy
applications
Docker allows developers to package libraries, dependencies, and
other necessary parts for an application and ship it all out as one
package
Docker Architecture
Docker Architecture
Docker is a client-server
architecture
- Docker client (usually
Docker CLI) talks to
Docker daemon
- Docker registry stores
images
What is a Dockerfile?
A Dockerfile is a text
document that contains all
the commands a user could
call on the command line to
assemble a Docker image
What is a Docker Image?
A Docker container image is a lightweight, standalone, executable
package of software
- Use build command to create an image from a Dockerfile
Docker Image Layers
Docker images are built from a
series of layers
- 1 layer/ instruction in
Dockerfile
- Layers are essentially files
generated from running a
command in your Dockerfile
- Docker stores each layer on the
host (for possible reuse later)
Docker Image Layers
Docker Image Layers
DockerHub Images
Repository of public images developers can use
Stable open-source images available to the public
What is a Docker Container?
If an image is a class, a container is
an instance of the class → a
runtime object
Containers are portable
encapsulations of an environment
to run an application
These containers are not static and
can actually be written to
Docker Images vs Containers
The difference between a
container and an image is the
top writable layer
- Any writes to a container
occur here
- can base multiple
containers off same
image (each container
has own writable
layer/unique data state)
What is a Data Volume?
A data volume is a specially designed directory in the container
Main Uses:
- Persistent storage of data
- Mounting host directories
Building Your Own Docker Image
What is Docker Compose?
Docker Compose is a tool for defining and running multi-container
Docker applications
- Defined YAML file
Docker Container Networking
With multiple containers, a layer of networking is needed for
communication (between each other and to the outside world)
Docker supports multiple network drivers but the most commonly
used one (and the one we’ll use here) is the bridge network (docker0)
Need to specify ports for containers to use to communicate between
containers or from each container to the outside world
Using Docker Compose
Using Docker Compose (2nd File)
Command Scripts
Command Scripts
Useful References
[Link]
[Link]
[Link]
cker-container
[Link]
[Link]
[Link]
[Link]
[Link]