influxdata-docker icon indicating copy to clipboard operation
influxdata-docker copied to clipboard

InfluxDB Docker image 2.3 has 60% size increase

Open ypnos opened this issue 2 years ago • 4 comments

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?

ypnos avatar Jul 21 '22 12:07 ypnos

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

J0WI avatar Aug 11 '22 14:08 J0WI

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 avatar Aug 13 '22 14:08 ypnos

For comparison, here are bitnami's images:

  1. 2.2.0 145 MB
  2. 2.3.0 130 MB

ypnos avatar Aug 13 '22 14:08 ypnos

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

This dir is created here:

https://github.com/influxdata/influxdata-docker/blob/d0e95946e90479b865f3ac3c072f6c888222bf9c/influxdb/2.3/Dockerfile#L38-L39

The other dirs are removed in:

https://github.com/influxdata/influxdata-docker/blob/d0e95946e90479b865f3ac3c072f6c888222bf9c/influxdb/2.3/Dockerfile#L59-L64

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/

wborn avatar Aug 20 '22 14:08 wborn