mirror of
https://github.com/11notes/docker-telegraf.git
synced 2025-11-01 20:33:31 +00:00
1.26.3
This commit is contained in:
33
README.md
33
README.md
@@ -1,18 +1,20 @@
|
|||||||
# Info
|
# Alpine :: Telegraf
|
||||||
The plugin-driven server agent for collecting & reporting metrics.
|
Run Nodejs based on Alpine Linux. Small, lightweight, secure and fast 🏔️
|
||||||
|
|
||||||
This container provides an easy and simple way to use telegraf without the hassle of library dependencies and compiling the source yourself.
|
|
||||||
|
|
||||||
## Volumes
|
|
||||||
None
|
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
```shell
|
```shell
|
||||||
docker run --name telegraf \
|
docker run --name telegraf \
|
||||||
-v /.../telegraf.conf:/telegraf/etc/telegraf.conf:ro \
|
-v /.../telegraf.conf:/telegraf/etc/telegraf.conf:ro \
|
||||||
-d 11notes/telegraf:[tag]
|
-d 11notes/telegraf:[tag]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Defaults
|
||||||
|
| Parameter | Value | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `user` | docker | user docker |
|
||||||
|
| `uid` | 1000 | user id 1000 |
|
||||||
|
| `gid` | 1000 | group id 1000 |
|
||||||
|
|
||||||
# Examples telegraf.conf
|
# Examples telegraf.conf
|
||||||
```shell
|
```shell
|
||||||
[agent]
|
[agent]
|
||||||
@@ -36,6 +38,13 @@ docker run --name telegraf \
|
|||||||
urls = ["http://localhost:8080/metrics"]
|
urls = ["http://localhost:8080/metrics"]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build with
|
## Parent
|
||||||
* [telegraf](https://github.com/influxdata/telegraf) - Telegraf
|
* [11notes/alpine:stable](https://github.com/11notes/docker-alpine)
|
||||||
* [Alpine Linux](https://alpinelinux.org/) - Alpine Linux
|
|
||||||
|
## Built with
|
||||||
|
* [telegraf](https://github.com/influxdata/telegraf)
|
||||||
|
* [Alpine Linux](https://alpinelinux.org/)
|
||||||
|
|
||||||
|
## Tips
|
||||||
|
* Don't bind to ports < 1024 (requires root), use NAT/reverse proxy
|
||||||
|
* [Permanent Stroage](https://github.com/11notes/alpine-docker-netshare) - Module to store permanent container data via NFS/CIFS and more
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# :: Build
|
# :: Build
|
||||||
FROM golang:alpine as telegraf
|
FROM golang:alpine as build
|
||||||
ENV checkout=v1.26.1
|
ENV checkout=v1.26.3
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --update --no-cache \
|
apk add --update --no-cache \
|
||||||
@@ -13,34 +13,33 @@
|
|||||||
mv telegraf /usr/local/bin;
|
mv telegraf /usr/local/bin;
|
||||||
|
|
||||||
# :: Header
|
# :: Header
|
||||||
FROM alpine:latest
|
FROM 11notes/alpine:stable
|
||||||
COPY --from=telegraf /usr/local/bin/ /usr/local/bin
|
COPY --from=build /usr/local/bin/ /usr/local/bin
|
||||||
|
|
||||||
# :: Run
|
# :: Run
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# :: prepare
|
# :: update image
|
||||||
|
RUN set -ex; \
|
||||||
|
apk update; \
|
||||||
|
apk upgrade;
|
||||||
|
|
||||||
|
# :: prepare image
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
mkdir -p /telegraf; \
|
mkdir -p /telegraf; \
|
||||||
mkdir -p /telegraf/etc;
|
mkdir -p /telegraf/etc;
|
||||||
|
|
||||||
RUN set -ex; \
|
# :: copy root filesystem changes and add execution rights to init scripts
|
||||||
apk add --update --no-cache \
|
|
||||||
shadow;
|
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
addgroup --gid 1000 -S telegraf; \
|
|
||||||
adduser --uid 1000 -D -S -h /telegraf -s /sbin/nologin -G telegraf telegraf;
|
|
||||||
|
|
||||||
# :: copy root filesystem changes
|
|
||||||
COPY ./rootfs /
|
COPY ./rootfs /
|
||||||
|
|
||||||
# :: docker -u 1000:1000 (no root initiative)
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
chown -R telegraf:telegraf \
|
chmod +x -R /usr/local/bin;
|
||||||
/telegraf
|
|
||||||
|
# :: change home path for existing user and set correct permission
|
||||||
|
RUN set -ex; \
|
||||||
|
usermod -d /telegraf docker; \
|
||||||
|
chown -R 1000:1000 \
|
||||||
|
/telegraf;
|
||||||
|
|
||||||
# :: Start
|
# :: Start
|
||||||
RUN set -ex; chmod +x /usr/local/bin/entrypoint.sh
|
USER docker
|
||||||
USER telegraf
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
Reference in New Issue
Block a user