A modern version of the "dockersamples/docker-swarm-visualizer" app
7.0K
The Swarm Visualizer extends on the dockersamples/docker-swarm-visualizer concept demo'd at the 2015 DockerCon EU keynote.
Its goals are:
docker service create visualizer \
-e CLUSTER_NAME="Dev Cluster" \
-p 8080:8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
--constraint node.role==manager
jtgasper3/swarm-visualizer
service:
viz:
image: jtgasper3/swarm-visualizer:latest
deploy:
placement:
constraints:
- node.role==manager
environment:
CLUSTER_NAME: Dev Cluster
ports:
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
General Environment Variables:
CLUSTER_NAME: title to display on the main pageCONTEXT_ROOT: the context root of the web app; useful when working with reverse-proxies (default: /)LISTENER_PORT: port to listen on (default: 8080)HIDE_ALL_CONFIGS: hides all configs values (default: false)HIDE_ALL_ENVS: hides all environment variables values (default: false)HIDE_ALL_MOUNTS: hides all mounts values (default: false)HIDE_ALL_SECRETS: hides all secrets values (default: false)HIDE_LABELS: comma list of values that hides labels values from all, container, network, node, service (default: (nothing))SENSITIVE_DATA_PATHS: comma delimited path of values to remove from the exported data. See Data Sanitization belowOIDC Environment Variables:
ENABLE_AUTHN: true enable OIDC authentication support (default: false)OIDC_CLIENT_ID: standard OAuth client idOIDC_CLIENT_SECRET_FILE: path to file containing a standard OAuth client secretOIDC_REDIRECT_URL: this app's callback url; should end in /callback and will be registered in the identity provider. For example, https://myswarm.example.internal/visualizer/callbackOIDC_SCOPES: comma separated list of scopes. For example, openid,profile,emailOIDC_WELL_KNOWN_URL: location to look up the identity provider's public signing key, token and authorization endpoints. For example, https://auth.example.com/.well-known/openid-configurationOIDC_AUTH_URL: authorization endpoint URL; overrides the value from OIDC_WELL_KNOWN_URL if setOIDC_TOKEN_URL: token endpoint URL; overrides the value from OIDC_WELL_KNOWN_URL if setOIDC_USERNAME_CLAIM: JWT claim to use as the display username (default: preferred_username)OIDC_SESSION_MAX_AGE: lifetime of the session cookie in seconds (default: 3600)Other Environment Variables:
DOCKER_API_VERSION: adjust the Docker api version if the server needs it. (default: (negotiated))TRUSTED_PROXIES: comma-separated list of trusted reverse-proxy IP addresses or CIDR ranges. When set, the X-Real-IP and X-Forwarded-For headers are trusted for rate limiting purposes when the direct connection originates from a listed address. Plain IPs are accepted alongside CIDR notation (e.g. 10.0.0.0/8,192.168.1.5). Only set this if the application port is not directly reachable by untrusted clients, otherwise clients can spoof their IP to bypass rate limits.When running behind a reverse proxy (such as Traefik or nginx), set TRUSTED_PROXIES to the proxy's IP or subnet and CONTEXT_ROOT to the path prefix if the app is not served from /. For example:
environment:
CONTEXT_ROOT: /visualizer/
TRUSTED_PROXIES: 10.0.0.0/8
The Docker API can expose potentially sensitive information. There are several methods to sanitize data from the payload that can be tailored to your needs:
HIDE_ALL_CONFIGS, HIDE_ALL_ENVS, HIDE_ALL_MOUNTS, and HIDE_ALL_SECRETS with the value of true will cause the application to strip the respective values from the output sent to the browser.HIDE_LABELS can be used to strip the output of various labels using a comma separated list of container, network, node, service. The value of all can also be used instead of specified all of the values.io.github.jtgasper3.visualizer.hide-labels) and environment variables (io.github.jtgasper3.visualizer.hide-envs) to specify a comma separated list of label or environment variables to remove from the service's specific labels or environment variable values from the output. The value is changes to "(sanitized)".For very granular control over uses that we didn't consider, use the environment variable of SENSITIVE_DATA_PATHS and a comma separated list of paths to remove. Examine the JSON output and find and specify the path to remove. Use * for arrays, and use single quotes to delimit values of property names that have embedded periods (i.e. services.*.Spec.TaskTemplate.ContainerSpec.Labels.'desktop.docker.io/mounts/0/Source').
If not already enabled:
docker swarm init
docker compose -f deployment/docker-compose.yml up --watch
The compose file mounts the static assets so they can be modified on the fly.
docker stack deploy -c test/docker-stack-test.yml test_1
docker stack deploy -c test/docker-stack-test.yml test_2
docker service create --name httpd httpd:2.4
Stop dummy services:
docker service rm httpd
docker stack rm test_1
docker stack rm test_2
Remove Swarm mode:
docker swarm leave --force
Content type
Image
Digest
sha256:0de475661…
Size
11.8 MB
Last updated
1 day ago
docker pull jtgasper3/swarm-visualizer