I am using the exact same section in two different Dockerfiles (base is ubuntu:18.04 in both cases) that downloads two files from a remote location using wget.
ENV ROBOT v1.5.0
ENV ROBOT_JAR=https://github.com/ontodev/robot/releases/download/$ROBOT/robot.jar
RUN wget $ROBOT_JAR -O /tools/robot.jar && \
wget https://raw.githubusercontent.com/ontodev/robot/$ROBOT/bin/robot -O /tools/robot && \
chmod +x /tools/*
docker history --no-trunc [...]
tells me that in the one Dockerfile, the layer created by this command, is 114 MB:
... /bin/sh -c wget $ROBOT_JAR -O /tools/robot.jar && wget https://raw.githubusercontent.com/ontodev/robot/$ROBOT/bin/robot -O /tools/robot && chmod +x /tools/* 114MB
and in the other only 44.9MB:
... /bin/sh -c wget $ROBOT_JAR -O /tools/robot.jar && wget https://raw.githubusercontent.com/ontodev/robot/$ROBOT/bin/robot -O /tools/robot && chmod +x /tools/* 44.9MB
Apart from being the same base, the Dockerfiles are of course very different (the 114MB one is huge, for example, while the 45MB one has only two defined layers); I am curious: What could cause the difference in size? Can this be mitigated somehow?
EDIT 1:
Here is the 114 MB case: https://github.com/INCATools/ontology-development-kit/blob/master/Dockerfile
Here is the other: https://github.com/INCATools/ontology-development-kit/blob/master/docker/testdocker/Dockerfile