Skip to content

Commit cef8ae5

Browse files
authored
Merge pull request #57 from Hurricos/master
feat: Build with CAP_NET_RAW by default to simplify rootless use
2 parents c9777d3 + 82ea2c9 commit cef8ae5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/bin/ping_expo
55

66
FROM alpine:latest
77
ENV CONFIG_FILE "/config/config.yml"
8-
RUN apk --no-cache add ca-certificates
8+
RUN apk --no-cache add ca-certificates libcap
99
WORKDIR /app
1010
COPY --from=builder /go/bin/ping_exporter .
11+
RUN setcap cap_net_raw+ep /app/ping_exporter
1112
CMD ./ping_exporter --config.path $CONFIG_FILE
1213
EXPOSE 9427

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ On Linux systems `CAP_NET_RAW` is required to run `ping_exporter` as unprivilige
146146
# setcap cap_net_raw+ep /path/to/ping_exporter
147147
```
148148

149+
When run through a rootless Docker implementation on Linux, the flag `--cap-add=CAP_NET_RAW` should be added to the `docker run` invocation.
150+
149151
### Docker
150152

151153
https://hub.docker.com/r/czerwonk/ping_exporter

0 commit comments

Comments
 (0)