https://github.com/jmb12686/docker-socat
Multi-architecture, containerized socat command. Used to relay arbitrary socket data or specifically to export experimental Docker daemon metrics to Prometheus
https://github.com/jmb12686/docker-socat
docker docker-swarm multi-arch-images
Last synced: 6 months ago
JSON representation
Multi-architecture, containerized socat command. Used to relay arbitrary socket data or specifically to export experimental Docker daemon metrics to Prometheus
- Host: GitHub
- URL: https://github.com/jmb12686/docker-socat
- Owner: jmb12686
- Created: 2019-10-18T19:36:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T15:39:26.000Z (about 5 years ago)
- Last Synced: 2025-02-13T08:29:25.323Z (8 months ago)
- Topics: docker, docker-swarm, multi-arch-images
- Language: Dockerfile
- Size: 12.7 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-socat (multi-architecture socat Docker image)
Inspired by [stefanprodan/dockerd-exporter](https://github.com/stefanprodan/dockerd-exporte) with added support for ARM / ARM64 multiarchitecture images. Runs the `socat` program in a base alpine image. Can be used to relay arbitrary socket data or specifically export experimental Docker daemon metrics to Prometheus.
## Install and Usage
### Setup Docker Engine
[Enable experimental metrics for docker engine](https://docs.docker.com/config/thirdparty/prometheus/#configure-docker) for address `0.0.0.0:9323`.Check if the docker_gwbridge ip address is 172.18.0.1:
`docker run --rm --net host alpine ip -o addr show docker_gwbridge`
### Docker Swarm
Create an overlay network:
```sh
docker network create \
--driver overlay \
netmon
```Create dockerd-exporter global service (replace 172.18.0.1 with your docker_gwbridge address):
```sh
docker service create -d \
--mode global \
--name dockerd-exporter \
--network netmon \
-e IN="172.18.0.1:9323" \
-e OUT="9323" \
jmb12686/socat:latest \
-d -d TCP-L:9323,fork TCP:172.18.0.1:9323
```Configure Prometheus to scrape the dockerd-exporter instances:
```
scrape_configs:
- job_name: 'dockerd-exporter'
dns_sd_configs:
- names:
- 'tasks.dockerd-exporter'
type: 'A'
port: 9323
```Run Prometheus on the same overlay network as dockerd-exporter.
## Build and Publish Socat Image
This image is designed to support multiarchitecture images for usage on both ARM and amd64 hosts. Setup local environment to support Docker experimental feature for building multi architecture images, [buildx](https://docs.docker.com/buildx/working-with-buildx/). Follow instructions [here](https://engineering.docker.com/2019/04/multi-arch-images/)Clone repo:
```bash
$ git clone https://github.com/jmb12686/raspi-docker-stacks
$ cd raspi-docker-stacks/prometheus/dockerd-exporter
```Build multiarch image:
```bash
$ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t jmb12686/socat:latest --push .
```