⚡️ Feature: Swarm Support
Feature Description
Support Swarm Stacks, Services and Nodes management like Portainer does.
Problem It Solves
This can help people with swarm configuration to use Arcane as their main management interface. Because Portainer has only a 3 nodes free licensing. And project like Swarmpit are not really maintain and integrated with docker standalone support like Arcane does.
Proposed Solution
Add 3 tabs and add the api requests with the docker socket.
Alternatives Considered
No response
Additional Context
No response
Would you be willing to work on this feature?
- [ ] Yes, I'd like to implement this feature
- [x] I could help with parts of this feature
- [ ] No, I'm just suggesting the feature
I do not use docker swarm, so i do not have much experience with it i would have to research it a lot to figure that out. If you want to take a stab at it at east the initial concept feel free :), that may help me understand it more as well.
I’ll give it a look and start implementing it in arcane
these would be nice, maybe look into https://github.com/cuigh/swirl pretty old but has all features i can think of
Another implementation example in Dokploy (Typescript)
Also https://github.com/swarmpit/swarmpit
I'm happy to help with tests. Currently blocked by portainer with docker 28...
You can try these if you would like:
Manager: ghcr.io/getarcaneapp/arcane:pr-1493 Agent: ghcr.io/getarcaneapp/arcane-headless:pr-1493
Im not sure if i did this the best way or not, so open to sugestions...
cant create a stack because of this error project name cant be empty
the project name is not empty
Sorry got preoccupied with other things... Working on it now hopefully... i dont use swarm so i dont know all the ins and outs of this... so hopefully the implementation is right and enough
I made changes to that image, you should at least be able to deploy now.
it doesn't work
@luluprat @lucilecoutouly Have you try to start your compose file with?:
name: test
services:
…
hello I only try to save a docker compose file not to start it .
it doesn't work
![]()
Did you make sure on pull the most updated version of that image? It looks like you may still be running the old one.
Also if anyone has a basic example of a swarm stack that i can put in when creating a new one thatd be great. Should be a very basic one with all of the core swarm features though, as id use it in the e2e tests.
@luluprat By start I meant the beginning of the file, that should have a name: key before the services: as shown in my snippet.
The first line of your compose file is services:, but before that the compose file shall have a name: my-stack. In older versions of the compose file, a version: was required instead of the name:.
ok thanks so this doesnt work either
STDERR STDERR STDERR 2026/02/10 11:04:38 [Recovery] 2026/02/10 - 11:04:38 panic recovered: STDERR runtime error: index out of range [0] with length 0 STDERR runtime/panic.go:115 (0x4443f3) STDERR github.com/getarcaneapp/arcane/backend/internal/services/swarm_service.go:574 (0x1ea28f5) STDERR github.com/getarcaneapp/arcane/backend/internal/services/swarm_service.go:567 (0x1ea1324) STDERR github.com/getarcaneapp/arcane/backend/internal/services/swarm_service.go:339 (0x1ea0044) STDERR github.com/getarcaneapp/arcane/backend/internal/huma/handlers/swarm.go:475 (0x1f21187) STDERR github.com/danielgtaylor/huma/[email protected]/huma.go:930 (0x1fe7401) STDERR github.com/getarcaneapp/arcane/backend/internal/huma/middleware/auth.go:162 (0x21dc064) STDERR github.com/danielgtaylor/huma/[email protected]/chain.go:16 (0x7a2084) STDERR github.com/danielgtaylor/huma/[email protected]/adapters/humagin/humagin.go:162 (0xe11216) STDERR github.com/gin-gonic/[email protected]/context.go:192 (0xdf792d) STDERR github.com/getarcaneapp/arcane/backend/internal/middleware/environment_middleware.go:89 (0x21fe910) STDERR github.com/gin-gonic/[email protected]/context.go:192 (0xdf792d) STDERR github.com/samber/[email protected]/middleware.go:140 (0x21f2de4) STDERR github.com/gin-gonic/[email protected]/context.go:192 (0xdf792d) STDERR github.com/gin-gonic/[email protected]/recovery.go:92 (0xe05e70) STDERR github.com/gin-gonic/[email protected]/context.go:192 (0xdf792d) STDERR github.com/gin-gonic/[email protected]/gin.go:689 (0xe04794) STDERR github.com/gin-gonic/[email protected]/gin.go:643 (0xe0412c) STDERR net/http/server.go:3340 (0x75b48d) STDERR net/http/server.go:2109 (0x739da4) STDERR runtime/asm_amd64.s:1693 (0x4864c0) STDERR
@kmendell i believe this is a good canonical example (i had claude generate it so bear that in mind)
I am on my 3rd database corruption in portainer in a year, and i am done with them, i have padi them $150 a year for nearly 5 years so highly motivated... not sure you want my claude code contributions, but maybe, i can send you a project example
tbh i usually use a small subset of these, the key is certain directives from a normal compose and not supported in a stack, the DEPLOY section are unique to swarms and commonly used, AMA
Copy
# =============================================================================
# CANONICAL DOCKER SWARM STACK FILE
# Compose/Stack file format version 3.9 (latest supported by Docker Swarm)
# Every top-level key and every supported sub-key is represented.
# Keys that are IGNORED by `docker stack deploy` are omitted entirely.
# All values are illustrative placeholders — replace before use.
# Reference: https://docs.docker.com/compose/compose-file/compose-file-v3/
# =============================================================================
version: "3.9"
# =============================================================================
# SERVICES
# =============================================================================
services:
# ---------------------------------------------------------------------------
# Example: Web / Application tier
# ---------------------------------------------------------------------------
web:
# --- Image ----------------------------------------------------------------
image: nginx:1.25-alpine # registry/image:tag
# --- Container naming -----------------------------------------------------
# `container_name` is NOT supported in swarm mode (ignored). Omitted.
# --- Environment ----------------------------------------------------------
environment:
- APP_ENV=production # KEY=VALUE form
- APP_DEBUG=false
env_file:
- .env # file of KEY=VALUE pairs
# --- Command / Entrypoint -------------------------------------------------
command: ["nginx", "-g", "daemon off;"] # overrides CMD in Dockerfile
entrypoint: ["/docker-entrypoint.sh"] # overrides ENTRYPOINT
# --- Ports ----------------------------------------------------------------
ports:
- target: 80 # container port
published: 8080 # host/swarm ingress port
protocol: tcp # tcp | udp
mode: ingress # ingress (swarm LB) | host (bypass LB)
- target: 443
published: 8443
protocol: tcp
mode: ingress
# --- Networks -------------------------------------------------------------
networks:
frontend:
aliases:
- web-alias # resolvable name on this network
ipv4_address: 10.10.0.10 # requires ipam.config on the network
backend: {} # no extra options
# --- Volumes --------------------------------------------------------------
volumes:
- type: volume
source: webdata # named volume (defined below)
target: /usr/share/nginx/html
read_only: false
volume:
nocopy: false # don't copy existing data from container
- type: bind
source: /host/path/nginx.conf # absolute host path
target: /etc/nginx/nginx.conf
read_only: true
bind:
propagation: rprivate # private|shared|slave|rprivate|rshared|rslave
- type: tmpfs
target: /tmp
tmpfs:
size: 67108864 # bytes (64 MiB)
# --- Secrets --------------------------------------------------------------
secrets:
- source: tls_cert # secret name (defined below)
target: /run/secrets/tls_cert # path inside container
uid: "0"
gid: "0"
mode: 0440 # octal permission
# --- Configs --------------------------------------------------------------
configs:
- source: nginx_config # config name (defined below)
target: /etc/nginx/conf.d/default.conf
uid: "0"
gid: "0"
mode: 0444
# --- Labels ---------------------------------------------------------------
labels:
com.example.service: "web"
com.example.version: "1.0.0"
traefik.enable: "true"
# --- Logging --------------------------------------------------------------
logging:
driver: json-file # json-file|syslog|journald|gelf|fluentd|awslogs|splunk|none
options:
max-size: "10m"
max-file: "5"
tag: "{{.Name}}/{{.ID}}"
# --- Health Check ---------------------------------------------------------
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/healthz"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s # grace period before health is checked
# --- Resource limits (ulimits not supported in swarm; use deploy.resources) -
# --- Stop behavior --------------------------------------------------------
stop_grace_period: 30s # time to wait before SIGKILL
stop_signal: SIGTERM
# --- User / Working dir ---------------------------------------------------
user: "1000:1000" # UID:GID or username
working_dir: /app
hostname: web-node # container hostname (per-task)
domainname: example.com
# --- Sysctls (supported in swarm mode) ------------------------------------
sysctls:
net.core.somaxconn: "1024"
net.ipv4.tcp_syncookies: "1"
# --- Cap add/drop (supported in swarm mode) --------------------------------
cap_add:
- NET_BIND_SERVICE
cap_drop:
- ALL
# --- Read-only root filesystem --------------------------------------------
read_only: false
# --- Init (tini-style PID 1) ----------------------------------------------
init: true
# --- Deploy (SWARM-ONLY — the heart of swarm configuration) --------------
deploy:
# Replicas vs global
mode: replicated # replicated | global
replicas: 3 # only valid for mode: replicated
# Placement
placement:
constraints:
- "node.role == worker" # manager | worker
- "node.hostname != dev-node-01"
- "node.labels.zone == us-east-1a"
- "engine.labels.operatingsystem == linux"
preferences:
- spread: node.labels.zone # spread replicas across label values
max_replicas_per_node: 1 # replicas ceiling per node
# Resource reservations and limits
resources:
limits:
cpus: "1.00" # fractional CPUs
memory: 512M # bytes, K, M, G
pids: 200 # max PID count (Docker 20.10+)
reservations:
cpus: "0.25"
memory: 128M
generic_resources: # advertise custom resources (e.g. GPUs)
- discrete_resource_spec:
kind: "NVIDIA-GPU"
value: 1
# Restart policy
restart_policy:
condition: on-failure # none | on-failure | any
delay: 5s # between restart attempts
max_attempts: 3 # 0 = unlimited
window: 120s # evaluation window
# Update config (rolling updates)
update_config:
parallelism: 1 # tasks updated simultaneously
delay: 10s # between each batch
failure_action: rollback # continue | pause | rollback
monitor: 30s # after each update, watch for failure
max_failure_ratio: 0.0 # fraction of tasks allowed to fail (0.0–1.0)
order: stop-first # stop-first | start-first
# Rollback config
rollback_config:
parallelism: 1
delay: 0s
failure_action: pause # continue | pause
monitor: 15s
max_failure_ratio: 0.0
order: stop-first # stop-first | start-first
# Service-level labels (applied to the SERVICE object, not the task/container)
labels:
com.example.deploy: "web"
com.example.tier: "frontend"
# Endpoint mode
endpoint_mode: vip # vip (virtual IP, default) | dnsrr (DNS round-robin)
# ---------------------------------------------------------------------------
# Example: Worker / Background task (global mode)
# ---------------------------------------------------------------------------
worker:
image: myapp/worker:latest
networks:
- backend
environment:
QUEUE_URL: "amqp://rabbitmq:5672"
secrets:
- db_password
deploy:
mode: global # one task per swarm node
placement:
constraints:
- "node.role == worker"
resources:
limits:
cpus: "0.50"
memory: 256M
reservations:
cpus: "0.10"
memory: 64M
restart_policy:
condition: any
delay: 10s
window: 60s
update_config:
parallelism: 1
delay: 5s
failure_action: rollback
order: start-first # start replacement before stopping old
rollback_config:
parallelism: 1
delay: 0s
failure_action: pause
order: stop-first
labels:
com.example.service: "worker"
logging:
driver: json-file
options:
max-size: "20m"
max-file: "3"
healthcheck:
test: ["CMD-SHELL", "pgrep worker || exit 1"]
interval: 60s
timeout: 5s
retries: 2
start_period: 30s
stop_grace_period: 60s
# ---------------------------------------------------------------------------
# Example: Database (single replica, constrained to a specific node)
# ---------------------------------------------------------------------------
db:
image: postgres:16-alpine
networks:
- backend
environment:
POSTGRES_DB: appdb
POSTGRES_USER: appuser
secrets:
- source: db_password
target: /run/secrets/db_password
mode: 0400
volumes:
- type: volume
source: pgdata
target: /var/lib/postgresql/data
volume:
nocopy: true
healthcheck:
test: ["CMD-SHELL", "pg_isready -U appuser -d appdb"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- "node.labels.db == true" # pin to node with this label
resources:
limits:
cpus: "2.00"
memory: 2G
reservations:
cpus: "0.50"
memory: 512M
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 60s
update_config:
parallelism: 1
delay: 30s
failure_action: rollback
order: stop-first # always stop-first for stateful services
rollback_config:
parallelism: 1
failure_action: pause
order: stop-first
endpoint_mode: dnsrr # no VIP, direct DNS round-robin
labels:
com.example.service: "database"
logging:
driver: json-file
options:
max-size: "50m"
max-file: "7"
stop_grace_period: 120s # give postgres time to checkpoint
# =============================================================================
# NETWORKS
# =============================================================================
networks:
frontend:
driver: overlay # overlay required for swarm multi-host
driver_opts:
encrypted: "true" # encrypt data-plane traffic (IPsec)
attachable: true # allow non-swarm containers to attach
internal: false # true = no external routing
ipam:
driver: default
config:
- subnet: 10.10.0.0/24
gateway: 10.10.0.1
ip_range: 10.10.0.128/25 # range within subnet for container IPs
aux_addresses:
reserved: "10.10.0.254" # addresses excluded from IPAM
labels:
com.example.network: "frontend"
backend:
driver: overlay
driver_opts:
encrypted: "true"
attachable: false
internal: true # backend is fully isolated from external
ipam:
driver: default
config:
- subnet: 10.20.0.0/24
labels:
com.example.network: "backend"
# Use a pre-existing network (e.g., ingress or externally managed)
external_net:
external: true # network already exists; don't create
name: my-pre-existing-overlay # actual name of the external network
# =============================================================================
# VOLUMES
# =============================================================================
volumes:
webdata:
driver: local # local | nfs | other plugin
driver_opts: # driver-specific options
type: none
o: bind
device: /mnt/data/webdata
labels:
com.example.volume: "webdata"
pgdata:
driver: local
driver_opts:
type: nfs
o: "addr=nas.example.com,rw,nfsvers=4"
device: ":/exports/pgdata"
labels:
com.example.volume: "pgdata"
# Use a pre-existing volume
external_vol:
external: true # volume already exists; don't create
name: my-pre-existing-volume
# =============================================================================
# SECRETS
# (Secrets are stored in the Swarm Raft log, encrypted at rest)
# =============================================================================
secrets:
# Secret created from a file at deploy time
tls_cert:
file: ./secrets/tls.crt # path on the manager running `stack deploy`
labels:
com.example.secret: "tls-cert"
# Secret created from an environment variable at deploy time
db_password:
environment: DB_PASSWORD_ENV_VAR # reads from this env var on the deploy host
# Use a pre-existing secret (already created with `docker secret create`)
external_secret:
external: true # secret already exists; don't create
name: my-pre-existing-secret
# =============================================================================
# CONFIGS
# (Configs are non-sensitive data stored in Swarm Raft, mounted into containers)
# =============================================================================
configs:
# Config created from a file at deploy time
nginx_config:
file: ./config/nginx-default.conf
labels:
com.example.config: "nginx"
# Config created from an environment variable
app_config:
environment: APP_CONFIG_ENV_VAR
# Use a pre-existing config
external_config:
external: true # config already exists; don't create
name: my-pre-existing-config
happy to share some examples here:
https://gist.github.com/scyto/f4624361c4e8c3be2aad9b3f0073c7f9
note some of these are a little elderly (like having the services key which is no longer needed)
Quick List of Features for swarms:
- stacks section
- configs section
- secrets section
- care on presenting volume as unused (to give an example deleting a volume with certain volume drivers on one node where the volume is unused may result in the volume being deleted on other nodes in the swarm)
- care on presenting images as unused ...
- care on presenting neworks as unused ...
- swarm section that shows leaders/menbers and status
- ability to show stack > services > particpating nodes (i.e. treel like view or somesuch)
i will add more as i think of them