[a container runtime for software deployments]
by João Rocha da Silva, based on 'Using Docker: Developing and Deploying Software with Containers' by Adrian Mouat and other sources.
VirtualBox by Oracle - (Open source hypervisor)
Source: "Orientation and setup", by Docker
Elasticity for the cloud
Separation of code from state
Native CPU scheduling
Images from Using Docker: Developing and Deploying Software with Containers
Docker Images (Based on an image by Docker - Source)
pull
them from an image registry, i.e. Docker Hub, or build and push
your own to Docker hub to publish your work.ubuntu
image (base image) and install additional libraries, resulting in a new image.
Docker containers (Based on an image by Docker - Source)
start
, stop
, move
, or delete
containers using the docker
command.save
a new image from the current state of a container.If you start
a container from an image and anything is modified inside the former, all changes be lost when you stop
and rm
(remove) it.
Docker volumes (Image by Docker - Source)
tmpfs
in Linux to create a memory-based volume for using RAM as a virtual file structure
Docker volumes (Image by Docker - Source)
readonly
volumes will allow the container to read files in the volume, but not change themVery useful for backups
Slow I/O on non-Linux Operating Systems
Volumes are mounted when a container is booted, replacing the contents of the folder in the container with the contents of the volume folder from the host
bridge
, host
, overlay
, macvlan
and none
none
will disable networking completely-no communicationbridge
and host
.Source: https://docs.docker.com/network/
bridge
mode)
Docker Networking (Bridge mode)
ping solr
on my-app
container will return the IP of my-app
, as given by the Docker DHCP server).ping solr
on Alice's machine will return Host Not Found).ping alice
will return alice's IP, as given by Internet Gateway) and access the Internet.bridge
networks can be created, and containers can will communicate within the same bridge
network (for separation).host
mode)
Docker Networking (Host mode)
my-app
running on Bob will not get any response if it runs ping mysql
bob.lan <ip>
) must be added at the physical network host resolution levelDockerfile
without any extension.# Start with a base image of Ubuntu 18.04, then:FROM ubuntu:18.04 # Copy current folder on the host to /app on the containerCOPY . /app# run `make` (compilation, etc) on /app to build the app on the containerRUN make /app # Set default command when container boots up (runs installed app)CMD python /app/app.py
To build an image from a Dockerfile
in the current directory, you run:
docker build .
Dockerfile
examples can be found here and here if you are curious.docker build
command referenceRemember to turn on Virtualization Support (or VT-x) on your BIOS/ UEFI (press Delete/F2 before Windows Starts) in order to run virtualization apps like Docker or a VM Hypervisor. See more here.
Oops, I forgot to turn on Virtualization!
docker run \ # \ # run is the command for running a container -d \ # \ # run in detached mode (without this, \ # the container will stop when you close the \ # command line, instead of running in \ # the background and on system startup) -p 8080:8080 \ # \ # bind port 8080 of the container, \ # which is running the Apache+PHP server, \ # to the port 8080 of the host. This is \ # what allows you to type localhost:8080 \ # on the browser and have the container respond -it \ # \ # allocate a tty for the container process --name=php \ # \ # name of the container to create -v $(pwd)/html:/var/www/html \ # \ # create a volume to map \ # [current folder]/html on the \ # host to /var/www/html (default Apache \ # htdocs location) on the container quay.io/vesica/php73:dev # # name of the image to base # the container on (has Apache and PHP # pre-installed)
Using Docker: Developing and Deploying Software with Containers Mouat, A. (2016). O'Reilly Media, Inc.
Docker Overview Docker Docs https://docs.docker.com/get-started/overview/
Docker Networking Docker Docs https://docs.docker.com/network/
Most common Docker commands Docker Cheat Sheet
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |