diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 75 |
1 files changed, 54 insertions, 21 deletions
@@ -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 |
