Skip to content

Instantly share code, notes, and snippets.

@ipatalas
Forked from natebrennand/Dockerfile.echo
Created October 14, 2022 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipatalas/531a50899cec347bf595da814dd7da35 to your computer and use it in GitHub Desktop.
Save ipatalas/531a50899cec347bf595da814dd7da35 to your computer and use it in GitHub Desktop.

Docker Container Size Quirks

# minimal base image
from alpine:3.16.2
# run a no-op command
RUN echo "testing"
# minimal base image
from alpine:3.16.2
# create a directory in the filesystem
RUN mkdir /testing
# create a 5mb file
RUN head -c 5000000 /dev/urandom > /testing/5mb.testing.file
# assign read perms to file
RUN chmod +r /testing/*
# minimal base image
from alpine:3.16.2
# create a directory in the filesystem
RUN mkdir /testing
# create 5mb files
RUN head -c 5000000 /dev/urandom > /testing/5mb.testing.1.file
RUN head -c 5000000 /dev/urandom > /testing/5mb.testing.2.file
# assign read perms to file
RUN chmod +r /testing/*
# minimal base image
from alpine:3.16.2
# create a directory in the filesystem
RUN mkdir /testing
# create 5mb files
RUN head -c 5000000 /dev/urandom > /testing/5mb.testing.1.file
RUN head -c 5000000 /dev/urandom > /testing/5mb.testing.2.file
# assign read perms to file
RUN chmod +r /testing/* # chmod it once
RUN chmod +r /testing/* # chmod it again
# minimal base image
from alpine:3.16.2
# create a directory in the filesystem
RUN mkdir /testing
# create 5mb files
RUN head -c 5000000 /dev/urandom > /testing/5mb.testing.1.file
# assign read perms to file
RUN stat /testing/*
RUN chmod +r /testing/* # chmod it once
RUN stat /testing/*
RUN chmod +r /testing/* # chmod it again
RUN stat /testing/*
FROM alpine:3.16.2
ENV YQ_VERSION "v4.22.1"
RUN wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64
RUN mv yq_linux_amd64 /usr/local/bin/yq
RUN chmod +x /usr/local/bin/*
FROM alpine:3.16.2
ENV YQ_VERSION "v4.22.1"
RUN wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 \
&& mv yq_linux_amd64 /usr/local/bin/yq \
&& chmod +x /usr/local/bin/yq
ECHO_TAG=sizing-echo
NUANCE_TAG=sizing-nuance
PERMS_TAG=sizing-perms
PERMS_V2_TAG=sizing-perms-v2
YQ_TAG=sizing-yq
YQ_SLIM_TAG=sizing-yq-slim
dive-echo:
dive build -f Dockerfile.echo -t $(ECHO_TAG) .
dive-nuance:
dive build -f Dockerfile.nuance -t $(NUANCE_TAG) .
dive-perms:
dive build -f Dockerfile.perms -t $(PERMS_TAG) .
dive-perms-v2:
dive build -f Dockerfile.perms.v2 -t $(PERMS_V2_TAG) .
build-perms-verbose:
BUILDKIT_PROGRESS=plain docker build --no-cache -f Dockerfile.perms.verbose .
dive-yq:
dive build -f Dockerfile.yq -t $(YQ_TAG) .
dive-yq-slim:
dive build -f Dockerfile.yq.slim -t $(YQ_SLIM_TAG) .
build:
marp slides.md --pdf --allow-local-files
marp slides.md --html
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment