docker-nsolid icon indicating copy to clipboard operation
docker-nsolid copied to clipboard

Docker images are larger than they need to be

Open jloveridge opened this issue 8 years ago • 0 comments

I noticed the Dockerfile for the alpine images have the following in them:

# Get Dependencies
COPY ./nsolid-bundle-${NSOLID_VERSION}/nsolid-*${NODEJS_LTS}-alpine-x64.tar.gz .
# later it does the following in a RUN command
# Cleanup
&& rm nsolid*.tar.gz \
&& apk del .build-deps

Unfortunately since the tar.gz file is added in a separate layer removing the file as part of the RUN step doesn't reduce the image size. I would recommend either using ADD which can extract the contents of the archive. Or that you wget the file as part of the RUN command.

From the Dockerfile reference on ADD:

If is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory.

jloveridge avatar Apr 24 '17 15:04 jloveridge