influxdata / influxdata-docker

Official docker images for the influxdata stack
323 stars 248 forks source link

Support i386 images #161

Open tpounds opened 6 years ago

tpounds commented 6 years ago

Add support for i386 image variants across all Debian and Alpine images.

jsternberg commented 6 years ago

Would you be able to test the docker build on an i386 machine for me? I do not currently have one so I would need to find one without some help. Thanks.

tpounds commented 6 years ago

I don't have one but could spin up a VM to test it. FWIW, we are interested in using i386 images on 64-bit hosts to potentially reduce memory usage of the agents. We still need to benchmark the memory usage but having the i386 images available will make testing that easier for us.

jsternberg commented 6 years ago

We may need to have those as two separate labels then. The new multi architecture thing with Docker images is to run what your existing system has so the i386 images would not be chosen since they are built for running on an i386 host. We would need to separately build an amd64 image that runs i386 code.

tpounds commented 6 years ago

In cases where we want i386 images we either deploy or derive internal images from the upstream i386 repository. AFAICT, this is supported by the official build process per the documentation. I think for the Debian images it's just a matter of adding i386 to the Dockerfile switch statements. The Alpine images would need a similar mechanism since they are hard coded to download the amd64 variant.

tpounds commented 6 years ago

I took a stab at this (see: https://github.com/tpounds/influxdata-docker/commit/3d1af86f3f8c27ec61e135963f6bcad515e05fd3) but ran into a problem with the Alpine images due to the way packaging is done on amd64 since it has both cgo (dynamic) and non-cgo (static) builds. The main problem is that the static archive does not use the same directory layout as the non-static packages. Working around this discrepancy would make the Alpine Dockerfiles a mess. I think the produced archives need to be reworked in the downstream projects before the Alpine images can be fixed. Thoughts?

jsternberg commented 6 years ago

I wouldn't bother with the alpine images for now. I haven't configured the build architecture to work properly with multiple architectures for those. I might try to work that out a little bit later today or sometime this week, but it's not on the top of my priority list at the moment.

So even without the build problems, you would run into other problems because the update.go file likely needs to be updated too to correctly produce the files needed in docker-library/official-images.

I'll see if I can contact one of the Docker maintainers upstream to figure out how to run i386 on amd64. If that's your intention, then the method you used won't work. That method only works if the host reports that it is i386.