summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-06-10 20:43:08 -0600
committermo khan <mo.khan@gmail.com>2020-06-10 20:43:08 -0600
commit6f65e7fa18a406c5b233d7d692186b302d594971 (patch)
tree55b09e591e34c2f5c37f45af28332fff25e68339 /README.md
parentc5794d5b829ab12d09b535d8aaf2faad56cc6cf2 (diff)
build large image and small image
Diffstat (limited to 'README.md')
-rw-r--r--README.md75
1 files changed, 54 insertions, 21 deletions
diff --git a/README.md b/README.md
index c7507dc..5b91e18 100644
--- a/README.md
+++ b/README.md
@@ -5,12 +5,9 @@ date: 2020-06-10
---
# Developing with Docker
+## Mo Khan
-Mo Khan
-
-Backend Engineer
-
-Composition Analysis, GitLab
+| Software Engineer | Composition Analysis | GitLab |
# Agenda
@@ -209,8 +206,13 @@ relative: true
lang: docker
```
-```terminal8
-tree ./examples/001
+```bash
+$ cat examples/001/hello.rb
+```
+```file
+path: examples/001/hello.rb
+relative: true
+lang: ruby
```
# Dockerfile - RUN
@@ -267,26 +269,31 @@ 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
+bash -i examples/001/docker-exec.sh
```
# dive
+Useful for identifying bloat.
+https://github.com/wagoodman/dive
+
+* Displays each layer
+* Allows investigating files that are added/removed/changed in each layer
+
```terminal32
-dive $(docker ps | grep developing-with-docker:latest | awk '{ print $1 }' | tail -n1) /bin/sh
+bash examples/001/dive-exec.sh
```
-* Describe layers
-* Downloading multiple layers in parallel vs 1 large layer
-
# Compression
-More layers == more parallel downloads
-Smaller layers == faster downloads per layer
+* More layers == more parallel downloads
+* Smaller layers == faster downloads per layer
-# Compression (zstd)
+```terminal16
+bash -i examples/001/docker-large-download.sh
+```
-* Deflate files within layers
+# docker build -t big-image:latest examples/002/
```file
path: examples/002/Dockerfile
@@ -294,24 +301,50 @@ relative: true
lang: docker
```
-# Compression (zstd)
+```terminal32
+docker build -t big-image:latest examples/002/
+```
+# docker image ls
+
+```terminal8
+docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}"
+```
+
+# docker build -t small-image:latest examples/003/
+
+* Collapse layers
+* Cleanup unnecessary artifacts
+* Deflate files within layers
* Inflate files when container is launched
```file
-path: examples/002/run.sh
+path: examples/003/Dockerfile
relative: true
lang: docker
```
-# Compression
+```file
+path: examples/003/run.sh
+relative: true
+lang: sh
+```
+
+```terminal32
+docker build -t small-image:latest examples/003/
+```
-Before:
+# docker image ls
-After:
+```terminal8
+docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}"
+```
# Summary
+* Keep each layer small
+* More layers means more parallel downloads
+
# Fin
Thank you for your time