Skip to content

Instantly share code, notes, and snippets.

@kevinkirkup
Forked from NikoWoot/reduce-size.dockerimage
Created April 24, 2017 20:29
Show Gist options
  • Select an option

  • Save kevinkirkup/2238a01fa297bf3df1940e445aef0579 to your computer and use it in GitHub Desktop.

Select an option

Save kevinkirkup/2238a01fa297bf3df1940e445aef0579 to your computer and use it in GitHub Desktop.
Reduce size of Docker image
=================================================
After software installation
=================================================
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
=================================================
Docker on build process, include all files on directory build (include .git with old build)
Solution for reduce size of docker image (but for reuse is not good solution)
=================================================
File : .dockerignore
.bundle
.git
log
tmp
vendor
=================================================
Compress docker image
=================================================
ID=$(docker run -d image-name /bin/bash)
(docker export $ID | gzip -c > image.tgz)
gzip -dc image.tgz | docker import - flat-image-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment