DOCKER
An introduction
Matthias Noback
@matthiasnoback
info@matthiasnoback.nl
CONTAINERS
"Just" processes, connected through the network
Your application
MySQL
Varnish
Memcache
Redis
HAProxy
CONTAINERS
Are about isolation
Processes
Files
Networking
Resources
Users
DOCKER
A set of CLI scripts
docker build
docker run
docker volume
docker network
...
localhost
DOCKER
A daemon and a client
Docker
daemon
client
container container container
some-other-machine
DOCKER
A daemon and a client
Docker
daemon
client
container container container
IMAGES
Container blueprints
Files
Exposed ports
Volumes
IMAGES
Pull or build
Image
registry
image
Docker-
file
image
pull from use to build
IMAGE REGISTRY
hub.docker.com
IMAGE REGISTRY
Push your own images
Image
registry
push to
Docker-
file
image
use to build
CONTAINERS
Linked through
Networks
CONTAINERS
Configured through
Build process
Environment variables
Volume mounts
ASSIGNMENTS/
ALL.MD
Playing with docker and Dockerfiles
https://github.com/matthiasnoback/docker-workshop/
EXPOSE VS PUBLISH
A port is exposed by the image itself
Publishing it makes it accessible to the bridge network (possible conflicts)
You can map ports: [host port]:[container port]
DOCKERFILE
Describes the build process of a container image
FROM php:7.1-apache
COPY web/ /var/www/html/
RUN pecl install redis
RUN docker-php-ext-enable redis
Cached filesystem layers!
DOCKERFILE
Optimized build
FROM php:7.1-apache
RUN pecl install redis 
docker-php-ext-enable redis
COPY web/ /var/www/html/
BUILD CONTEXT
Files available while building the image
COPY web/ /var/www/html/
LOGGING
To stdout/stderr
No file rotation needed
You could look into logspout/Logstash/Kibana
There are also nice services for this
COPYING VS VOLUME MOUNTING
When to use what
Mount a volume while developing
Use COPY for creating the build artifact
READ-ONLY LAYERS
With a writeable layer on top
Stateful vs immutable
IMMUTABLE FILE SYSTEMS
How to store data on disk?
bind-mount volume
named volume ("volumes from")
fast/cache volume: tmpfs
CONTAINERS
Advantages
Self-contained ;)
Designed to be immutable (and predictable)
Infrastructure as code
Configuration has not been abstracted
Provisioning new servers is easy

Docker workshop