Created
December 19, 2014 08:37
-
-
Save NikoWoot/95cb133dca06143ce629 to your computer and use it in GitHub Desktop.
Reduce size of Docker image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================= | |
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