DRuggeri / nut_exporter

Network UPS Tools Prometheus Exporter
Other
172 stars 25 forks source link

Locally built containers are failing at startup #40

Closed mpeter50 closed 10 months ago

mpeter50 commented 11 months ago

In connection with #39 I was trying to build the Docker container of this repo based on the Dockerfile, but I am unable to run the container. docker ps -a indicates that it is constantly restarting, and docker logs <container name> prints the following:

Error loading shared library libresolv.so.2: No such file or directory (needed by /nut_exporter)
Error loading shared library libresolv.so.2: No such file or directory (needed by /nut_exporter)
Error loading shared library libresolv.so.2: No such file or directory (needed by /nut_exporter)
Error loading shared library libresolv.so.2: No such file or directory (needed by /nut_exporter)
Error loading shared library libresolv.so.2: No such file or directory (needed by /nut_exporter)

I was using this command to build the container, while in the cloned repo's direcory:

docker buildx build --load --tag local/nut_exporter:3.0.0 .

Please note that this is also happening without modifications to any files in the repository, but the druggeri/nut_exporter:3.0 image published to Docker Hub does work fine.

While searching for a solution, I have found reports that having the gcompat package installed with apk in the Dockerfile solves this problem, but in my case only the error messages go away, the container is still constantly in the restarting state.

mpeter50 commented 11 months ago

I also see that the Dockerfile dynamically produced by the github actions release process is very different compared to the Dockerfile in the repository.

Is the Dockerfile supposed to be up to date?

mpeter50 commented 11 months ago

I just noticed that building nut_exporter itself is done in a debian container (that is, for libc), even though it is then being ran in alpine (whoch uses musl).

When using alpine based golang for the builder the container runs fine.