prometheus-community / ipmi_exporter

Remote IPMI exporter for Prometheus
MIT License
474 stars 134 forks source link

current docker image is not executable #38

Closed convoi closed 5 years ago

convoi commented 5 years ago

make docker

docker build -t "soundcloud/ipmi-exporter-linux-amd64:master" \
    -f ./Dockerfile \
    --build-arg ARCH="amd64" \
    --build-arg OS="linux" \
    ./
Sending build context to Docker daemon  13.99MB
Step 1/9 : FROM quay.io/prometheus/golang-builder:1.13-base AS builder
 ---> 46243b0f7f63
Step 2/9 : RUN go get -d github.com/soundcloud/ipmi_exporter  && cd /go/src/github.com/soundcloud/ipmi_exporter  && make
 ---> Using cache
 ---> 8413e244a1f1
Step 3/9 : FROM ubuntu:18.04
 ---> 4c108a37151f
Step 4/9 : LABEL maintainer="Aggelos Kolaitis <neoaggelos@gmail.com>"
 ---> Using cache
 ---> b5f1c2a4d54f
Step 5/9 : WORKDIR /
 ---> Using cache
 ---> e0cf8c41e839
Step 6/9 : RUN apt-get update     && apt-get install freeipmi-tools -y --no-install-recommends     && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 5514312c0fa1
Step 7/9 : COPY --from=builder /go/src/github.com/soundcloud/ipmi_exporter /bin/ipmi_exporter
 ---> Using cache
 ---> 1cdbf630119c
Step 8/9 : EXPOSE 9290
 ---> Using cache
 ---> bd1e0ffddb76
Step 9/9 : CMD ["/bin/ipmi_exporter", "--config.file", "/config.yml"]
 ---> Using cache
 ---> 2c5d72b255fa
[Warning] One or more build-args [ARCH OS] were not consumed
Successfully built 2c5d72b255fa
Successfully tagged soundcloud/ipmi-exporter-linux-amd64:master

docker run 2c5d72b255fa

docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/bin/ipmi_exporter\": permission denied": unknown.
ERRO[0001] error waiting for container: context canceled 
h3po commented 5 years ago

the reason is that this copy is copying the directory instead of the binary: COPY --from=builder /go/src/github.com/soundcloud/ipmi_exporter /bin/ipmi_exporter it should be COPY --from=builder /go/src/github.com/soundcloud/ipmi_exporter/ipmi_exporter /bin/ipmi_exporter

also it would be better to set that binary as the entrypoint and --config /config/config.yml as the argument, so the image can be run with different arguments if needed.

bitfehler commented 5 years ago

Hi, thanks for flagging this, the COPY line is a typo indeed. The entrypoint thing also makes sense.

bitfehler commented 5 years ago

Should be fixed, let me know if you have any further issues.