metalmatze / alertmanager-bot

[deprecated] Bot for Prometheus' Alertmanager
MIT License
658 stars 147 forks source link

docker image doesn't start #120

Closed bukem closed 4 years ago

bukem commented 4 years ago

Hello, When I run docker container, it fails:

$ docker run -d -e 'ALERTMANAGER_URL=http://alertmanager:9093' -e 'BOLT_PATH=/etc/alertmanager/bot.db' -e 'STORE=bolt' -e 'TELEGRAM_ADMIN=<some_id>' -e 'TELEGRAM_TOKEN=<some_token>' -v '/srv/monitoring/alertmanager-bot:/etc/alertmanager' --name alertmanager-bot metalmatze/alertmanager-bot The only result is CT ID: 18cdc117da599a9ace18a7a45819152c68649fbf17f72d84bfcae89af382478c The reason is: $ docker logs 18cdc117da599a9ace18a7a45819152c68649fbf17f72d84bfcae89af382478c standard_init_linux.go:211: exec user process caused "exec format error"

Please help.

metalmatze commented 4 years ago

The images are built for Linux amd64, is that the architecture you run on? :latest is working just fine on my machine right now, so I guess that's a configuration mistake. Please note that :latest might break in the future as it directly mirrors the master branch. I advise you to use a proper tagged version: metalmatze/alertmanager-bot:0.4.2

bukem commented 4 years ago

Well... my is armv7. Docker is not applicable to me then?

metalmatze commented 4 years ago

Docker itself is able to run on ARM. The problem is the bot for you because I don't provide images for ARM out of the box. The best thing you can do is to build a container image yourself and simply curl on of the pre-built binaries: https://github.com/metalmatze/alertmanager-bot/releases/tag/0.4.2

Something like this (didn't test):

FROM alpine:latest
ENV TEMPLATE_PATHS=/templates/default.tmpl
RUN apk add --update ca-certificates curl

COPY ./default.tmpl /templates/default.tmpl
RUN curl https://github.com/metalmatze/alertmanager-bot/releases/download/0.4.2/alertmanager-bot-0.4.2-linux-arm -o /usr/bin/alertmanager-bot

ENTRYPOINT ["/usr/bin/alertmanager-bot"]

Or simply compile the bot directly and then build the container image with that binary, probably the best to guarantee the binary works. A simple make build from the root of the repository on the cloned repo should do the trick.

bukem commented 4 years ago

Decided to compile the binary from sources. And it works :) @metalmatze, thank you for your work!

metalmatze commented 4 years ago

Glad that compiling from source was that simple and worked out. That's how it should be in an open source world. 😊