Docker Inc Docker Fundamentals Course PDF
Docker Inc Docker Fundamentals Course PDF
FUNDAMENTALS
Fundamental Orchestration
Monolith Densification
Service-Based Architecture
Devops
Plugins
Docker Hub
Docker Cloud
e: training@docker.com
w: training.docker.com
Kernel namespaces
Root privilege management
System call restrictions
Private network stacks
etc
New Syntax:
Directory archive
Must contain all local files necessary for image
Will omit anything listed in .dockerignore
RUN cd /src
RUN bash setup.sh
because every Dockerfile command runs in a different container, and only the
filesystem, not the in-memory state, is persisted from layer to layer.
# Exec form
ENTRYPOINT ["sudo", "-u", "jdoe", "java", ...]
ARG defines arguments that can be passed in from the command line during
build:
ARG DB_MOUNT=/my/default/path
ENV DB_PATH $DB_MOUNT
FROM alpine:3.5
RUN apk update && \
apk add --update alpine-sdk
RUN mkdir /app
WORKDIR /app
ADD hello.c /app
RUN mkdir bin
RUN gcc -Wall hello.c -o bin/hello
CMD /app/bin/hello
builds to:
FROM alpine:3.4
...
COPY --from foo ...
COPY --from bar ...
...
...
ARG MYDEP=default
RUN gcc -Wall hello.c -o bin/hello
RUN apt-get install $MYDEP
...
... ...
ARG MYDEP=default RUN gcc -Wall hello.c -o bin/hello
RUN gcc -Wall hello.c -o bin/hello ARG MYDEP=default
RUN apt-get install $MYDEP RUN apt-get install $MYDEP
... ...
Note the -v option: volumes not automatically deleted when deleting a container.
# String example
VOLUME /myvol
# JSON example
VOLUME [“/myvol”, “/myvol2”]
$ docker plugin ls
ID NAME DESCRIPTION ENABLED
bee424413706 vieux/sshfs:latest sshFS plugin for Docker true
Services are assigned a Virtual IP which spreads traffic out across the underlying
containers automatically. 17.06-v1.3 © 2017 Docker, Inc.
OUR APPLICATION: DOCKERCOINS
It is a DockerCoin miner!
Dockercoins consists of 5 services
working together:
version: "3.3"
services:
rng:
image: user/dockercoins_rng:1.0
networks:
- dockercoins
ports:
- "8001:80"
hasher:
image: user/dockercoins_hasher:1.0
networks:
- dockercoins
ports:
- "8002:80"
...
docker service create --replicas 3 --name myapp --network mynet --publish 80:80 myapp:1.0
Swarm will schedule a new task in order to create the new container so that we
once again have 3 replicas.
SWIM PROTOCOL
1. Ask neighbor A if they're still alive
2. Ask three other neighbors if they can reach neighbor A
3. No to both: conclude neighbor A is unhealthy / dead
Creating a Swarm
Starting a Service
Node Failure Recovery
Problem: how does my load balancer know which nodes to send external traffic
to?
17.06-v1.3 © 2017 Docker, Inc.
THE ROUTING MESH
Dockercoins On Swarm
Scaling and Scheduling Services
Updating a Service
https://dockertraining.typeform.com/to/gjciUl
Get in touch: training@docker.com
training.docker.com