influxdata/influxdata-docker

InfluxDB Docker image 2.3 has 60% size increase

ypnos opened this issue · 4 comments

ypnos commented

There is a surprising growth for only minor changes in the shipped software:

  1. 2.2-alpine 120 MB
  2. 2.3-alpine 190 MB

Is there a legitimate cause for it or maybe an oversight and a considerably smaller 2.3 image could be produced?

J0WI commented

InfluxDB 2.3 itself is significant larger than 2.2: https://github.com/influxdata/influxdb/releases

ypnos commented

Thanks for your observation, however I don't quite understand it.

The file sizes of the amd64 tarballs on the release page are ~103 MB and ~85 MB for v2.2 and v2.3, respectively.
Uncompressed, it is ~165 MB and ~132 MB for v2.2 and v2.3, respectively.

So 2.3 actually looks smaller than 2.2 to me.

ypnos commented

For comparison, here are bitnami's images:

  1. 2.2.0 145 MB
  2. 2.3.0 130 MB
wborn commented

I think the size increase is due to the downloaded influxd files in /influxdb2_linux_${ARCH} are never removed.

This dir is created here:

tar xzf influxdb2-${INFLUXDB_VERSION}-linux-${ARCH}.tar.gz && \
cp influxdb2_linux_${ARCH}/influxd /usr/local/bin/influxd && \

The other dirs are removed in:

RUN gpgconf --kill all && \
rm -rf \
"/root/.gnupg" \
influxdb2.key \
influxdb2-${INFLUXDB_VERSION}-linux-${ARCH}* \
influxdb2-client-${INFLUX_CLI_VERSION}-linux-${ARCH}*

It'll probably also help to remove the files in the same RUN instruction used for downloading/unpacking to reduce the layer sizes. Each instruction will result in its own layer so the files will still be part of the layers if they are removed in another layer, see:

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/