feat: add native Docker Swarm support with service/task dashboard

Implements #26 — Adds first-class Swarm support, including service/task listing, Swarm-aware UI filtering, and updated deployment/documentation. Preserves all existing multi-host and standalone features.

Signed-off-by: Bryan Gonzalez <bgonza868@gmail.com>
This commit is contained in:
Bryan Gonzalez
2025-09-09 23:52:31 -04:00
committed by dockpeek
parent e810114e37
commit c52448d329
2 changed files with 130 additions and 0 deletions

View File

@@ -109,6 +109,81 @@ services:
restart: unless-stopped
```
### Option 3: Docker Swarm/Stack Deployment (with Traefik)
Dockpeek now supports native Docker Swarm mode! You can deploy Dockpeek as a stack, with a single socket-proxy instance, and view/manage all Swarm services and tasks in the dashboard. This is ideal for production clusters using Traefik as an ingress proxy.
**Example stack file (docker-compose-swarm-socket.yml):**
```yaml
services:
dockpeek:
image: ghcr.io/dockpeek/dockpeek:latest
environment:
- SECRET_KEY=your_secure_secret_key
- USERNAME=admin
- PASSWORD=secure_password
- TRAEFIK_LABELS=true
- DOCKER_HOST=tcp://tasks.socket-proxy:2375 # Connect to Swarm manager via socket-proxy
ports:
- "3420:8000"
networks:
- traefik
- dockpeek-internal
deploy:
replicas: 1
labels:
- "traefik.enable=true"
- "traefik.http.routers.dockpeek.rule=Host(`dockpeek.example.com`)"
- "traefik.http.routers.dockpeek.entrypoints=websecure"
- "traefik.http.routers.dockpeek.tls=true"
- "traefik.http.services.dockpeek.loadbalancer.server.port=8000"
socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
environment:
- CONTAINERS=1
- IMAGES=1
- PING=1
- VERSION=1
- INFO=1
- POST=1
- SERVICES=1 # Enable Swarm services API
- TASKS=1 # Enable Swarm tasks API
- NODES=1 # Enable Swarm nodes API
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- type: tmpfs
target: /run
tmpfs:
size: 100000000
networks:
- socket-proxy
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
networks:
socket-proxy:
traefik:
external: true
```
**How it works:**
- The dockpeek and socket-proxy services share a private network for secure API access.
- The traefik network is external and should be pre-created by your Traefik deployment.
- Traefik labels on dockpeek expose the dashboard securely at your chosen domain.
- The DOCKER_HOST variable points to the socket-proxy service, which must run on a Swarm manager node.
- Dockpeek will auto-detect Swarm mode and show all services/tasks in the dashboard, with all the usual features (port mapping, Traefik integration, update checks, etc.).
> Deploy with:
> ```sh
> docker stack deploy -c docker-compose-swarm-socket.yml dockpeek
> ```
<br>
### Adding Multiple Docker Hosts

View File

@@ -0,0 +1,55 @@
services:
dockpeek:
image: ghcr.io/dockpeek/dockpeek:latest
environment:
SECRET_KEY: your_secure_secret_key
USERNAME: admin
PASSWORD: secure_password
TRAEFIK_LABELS: "true"
DOCKER_HOST: tcp://tasks.socket-proxy:2375 # Connect to Swarm manager via socket-proxy
networks:
- traefik
- socket-proxy
# Go ahead and map the port if you don't plan on using Traefik to expose the ui
# ports:
# - "3420:8000"
deploy:
replicas: 1
# Adjust as needed
labels:
traefik.enable: "true"
traefik.swarm.network: traefik
traefik.http.routers.dockpeek.rule: Host(`dockpeek.example.com`)
traefik.http.routers.dockpeek.entrypoints: websecure
traefik.http.services.dockpeek.loadbalancer.server.port: 8000
socket-proxy:
image: lscr.io/linuxserver/socket-proxy:latest
environment:
CONTAINERS: 1
IMAGES: 1
PING: 1
VERSION: 1
INFO: 1
POST: 1
SERVICES: 1 # Enable Swarm services API
TASKS: 1 # Enable Swarm tasks API
NODES: 1 # Enable Swarm nodes API
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- type: tmpfs
target: /run
tmpfs:
size: 100000000
networks:
- socket-proxy
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
networks:
socket-proxy:
traefik:
external: true