Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Unable to bring down container size after deleting a package #45
I have the below Dockerfile and it creates an image of size 165 MB. When I install the haproxy instead of compiling with "apk add haproxy" the size of the container is 7MB. The size increase mostly corresponds to build-base package. Is there any way that I could bring down the size to the actual root filesystem size itself. The "du -h" command at the / gives 28MB.
RUN apk add --update git build-base linux-headers pcre-dev openssl-dev
RUN git clone https://github.com/haproxy/haproxy.git && cd haproxy &&
Your commands to remove packages and clean up cache are in new layers. You cannot remove stuff from previous layers already committed (this is a fundamental Docker thing). Remove the packages and clean up the command in the same layer by adding on to the compound command: