diff options
| -rw-r--r-- | README.md | 25 | ||||
| -rw-r--r-- | examples/001/docker-large-download.sh | 2 | ||||
| -rw-r--r-- | examples/002/Dockerfile | 1 | ||||
| -rw-r--r-- | examples/003/Dockerfile | 1 |
4 files changed, 21 insertions, 8 deletions
@@ -144,7 +144,7 @@ $ curl --unix-socket /var/run/docker.sock http://localhost/images/json curl -i --unix-socket /var/run/docker.sock http://localhost/images/json ``` -# $ docker +# $ docker version The docker CLI is an HTTP client that can connect to Unix or TCP sockets. @@ -245,7 +245,7 @@ lines: # docker build -t developing-with-docker:latest examples/001/ ```terminal32 -docker build -t developing-with-docker:latest examples/001/ +time docker build -t developing-with-docker:latest examples/001/ ``` # docker run developing-with-docker:latest @@ -284,7 +284,7 @@ https://github.com/wagoodman/dive bash examples/001/dive-exec.sh developing-with-docker ``` -# Compression +# docker pull registry.gitlab.com/gitlab-org/security-products/license-management:latest * More layers == more parallel downloads * Smaller layers == faster downloads per layer @@ -302,13 +302,19 @@ lang: docker ``` ```terminal32 -docker build -t big-image:latest examples/002/ +time docker build -t big-image:latest examples/002/ ``` # docker image ls ```terminal32 -docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}" +docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}" | grep -v gitlab +``` + +# dive big-image:latest + +```terminal32 +bash examples/001/dive-exec.sh big-image ``` # docker build -t small-image:latest examples/003/ @@ -331,7 +337,13 @@ lang: sh ``` ```terminal32 -docker build -t small-image:latest examples/003/ +time docker build -t small-image:latest examples/003/ +``` + +# docker image ls + +```terminal32 +docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.Size}}" | grep -v gitlab ``` # dive small-image:latest @@ -352,7 +364,6 @@ docker run -it small-image:latest docker image ls --format "table {{.ID}}\t{{.Tag}}\t{{.Size}}" ``` - # Summary * Keep each layer small diff --git a/examples/001/docker-large-download.sh b/examples/001/docker-large-download.sh index 659004c..9ab0e58 100644 --- a/examples/001/docker-large-download.sh +++ b/examples/001/docker-large-download.sh @@ -1,4 +1,4 @@ #!/bin/sh docker rmi -f "$(docker images | grep 'license-management')" 2> /dev/null -docker pull registry.gitlab.com/gitlab-org/security-products/license-management:latest +time docker pull registry.gitlab.com/gitlab-org/security-products/license-management:latest diff --git a/examples/002/Dockerfile b/examples/002/Dockerfile index 304abfb..faeeefc 100644 --- a/examples/002/Dockerfile +++ b/examples/002/Dockerfile @@ -5,3 +5,4 @@ RUN apt-get install -y git RUN apt-get install -y ruby RUN apt-get install -y zstd RUN git clone --verbose https://github.com/spandx/cache.git /opt/db +RUN echo 'Done' diff --git a/examples/003/Dockerfile b/examples/003/Dockerfile index a722743..baa4fa5 100644 --- a/examples/003/Dockerfile +++ b/examples/003/Dockerfile @@ -6,4 +6,5 @@ RUN apt-get update -y \ && tar --use-compress-program zstd -cf /opt/db.tar.zst /opt/db \ && rm -fr /opt/db COPY run.sh /run.sh +RUN chmod +x /run.sh ENTRYPOINT ["/run.sh"] |
