summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-06-10 18:32:30 -0600
committermo khan <mo.khan@gmail.com>2020-06-10 18:32:30 -0600
commit0f08fd690d9a03b29f88d7d71dfae2d31e7b6b5e (patch)
tree00d2fcbf63cd03cfbef8f980a6272a0919787dca
parent7263a3edf03b84abbdace78dd797d9184812b7db (diff)
Flush out the outline for each slide
-rw-r--r--README.md156
1 files changed, 116 insertions, 40 deletions
diff --git a/README.md b/README.md
index 61f6caa..f105483 100644
--- a/README.md
+++ b/README.md
@@ -6,22 +6,21 @@ date: 2020-06-10
# Developing with Docker
-Mo Khan, Backend Engineer
+Mo Khan
-Composition Analysis, GitLab
-
-https://gitlab.com/xlgmokha
+Backend Engineer
-Inspired by: gitlab-org/gitlab#216082
+Composition Analysis, GitLab
# Agenda
-* Build (build)
+* Definitions
+* Architecture
* Start/Stop container (ps, start, stop)
* Getting a shell (run vs exec)
+* Dockerfile
* Analyzing an image (dive, docker layers)
* Shrinking an image (compression, discuss the trade offs of having more v. less layers)
-* Sharing an image (push, pull, authn)
# Definitions
@@ -59,17 +58,60 @@ For example:
curl -s -i https://index.docker.io/v2/alpine/tags/list
```
-# Docker - Architecture
+# Architecture
+
+```text
+ ----------
+ | Client |
+ ----------
+ | build |
+ | pull |
+ | run |
+ ----------
+ |
+ V
+ --------------
+ | Host |
+ --------------
+ | Daemon |
+ | Containers |
+ | Images |
+ --------------
+ | A
+ V |
+ ------------
+ | Registry |
+ ------------
+ | Images |
+ ------------
+```
+
+https://docs.docker.com/get-started/overview/#docker-architecture
-```plantuml
+# $ docker image ls
+```terminal8
+docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}"
```
-https://docs.docker.com/get-started/overview/#docker-architecture
+# $ docker ps
-# Dockerfile
+```terminal8
+docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Status}}"
+```
+
+# $ docker run -it alpine:latest cat /etc/os-release
+
+```terminal32
+docker run -it alpine:latest cat /etc/os-release
+```
-A minimal Dockerfile:
+1. check if "alpine:latest" is on docker host
+1. download "alpine:latest" from registry to docker host
+1. start a container using the "alpine:latest" image
+
+
+# Dockerfile
```file
path: examples/001/Dockerfile
@@ -79,24 +121,17 @@ lang: docker
https://docs.docker.com/engine/reference/builder/
-# Dockerfile - FROM
-
-> Initializes a build stage and sets a Base Image.
+# FROM alpine:latest
-In this example the base image is alpine:latest.
-By default this image will be fetched from the default Docker registry.
-https://index.docker.io/
+Initializes a build stage and sets a Base Image.
```file
path: examples/001/Dockerfile
relative: true
lang: docker
-lines:
- start: 0
- end: 1
```
-# Dockerfile - COPY
+# COPY "hello.rb"
Copy "hello.rb" from the host to
"/usr/local/bin/hello" within the Docker image.
@@ -105,9 +140,6 @@ Copy "hello.rb" from the host to
path: examples/001/Dockerfile
relative: true
lang: docker
-lines:
- start: 1
- end: 2
```
```terminal8
@@ -137,40 +169,84 @@ path: examples/001/Dockerfile
relative: true
lang: docker
lines:
- start: 2
- end: 3
+ start: 3
+ end: 4
```
-# docker build
+# docker build -t developing-with-docker:latest examples/001/
```terminal32
-bash -il
+docker build -t developing-with-docker:latest examples/001/
```
-# docker ps
+# docker run developing-with-docker:latest
-# docker start
+```terminal32
+docker run developing-with-docker:latest
+```
-# docker stop
+# docker run -it developing-with-docker:latest /bin/sh
-# docker run
+```terminal32
+docker run -it developing-with-docker:latest /bin/sh
+```
-# docker exec
+# docker ps
+
+```terminal32
+docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Status}}"
+```
+
+# docker exec -it <imageid> /bin/sh
+
+```terminal32
+docker exec -it $(docker ps | grep developing-with-docker:latest | awk '{ print $1 }' | tail -n1) /bin/sh
+```
# dive
+```terminal32
+dive $(docker ps | grep developing-with-docker:latest | awk '{ print $1 }' | tail -n1) /bin/sh
+```
+
* Describe layers
* Downloading multiple layers in parallel vs 1 large layer
+# Compression
+
+More layers == more parallel downloads
+Smaller layers == faster downloads per layer
+
+# Compression (zstd)
+
+* Deflate files within layers
+
+```file
+path: examples/002/Dockerfile
+relative: true
+lang: docker
+```
+
# Compression (zstd)
-More layers == more parallel download
-Smaller layers == faster downloads
+* Inflate files when container is launched
+
+```file
+path: examples/002/run.sh
+relative: true
+lang: docker
+```
+
+# Compression
+
+Before:
+
+After:
-# Distribution
+# Summary
-# docker push
+# Fin
-# docker pull
+Thank you for your time
-# docker login
+[gitlab.com/xlgmokha/developing-with-docker](https://gitlab.com/xlgmokha/developing-with-docker)