Rust rewrite of the Docker Swarm control plane built entirely with the Rust ecosystem
A production-grade Rust rewrite of Docker Swarm (SwarmKit), built entirely with modern Rust ecosystem technologies.
RustSwarm is a distributed container orchestration platform that provides the same functionality as Docker Swarm, reimplemented from the ground up in Rust. It enables you to manage a cluster of Docker engines, deploy services, and orchestrate containerized applications across multiple nodes with fault-tolerant consensus and automatic scheduling.
RustSwarm follows a manager-worker architecture:
rustswarm/
├── crates/
│ ├── swarm-core/ # Data model, state management, and scheduler
│ ├── swarm-consensus/ # Raft integration and distributed consensus
│ ├── swarm-manager/ # Control plane (gRPC APIs, orchestration)
│ ├── swarm-agent/ # Worker node agent (task execution)
│ ├── swarm-node/ # Node-specific state view
│ ├── swarm-cli/ # Command-line interface and binaries
│ ├── swarm-proto/ # Protobuf definitions and generated code
│ └── swarm-store/ # Persistent storage layer
├── proto/ # SwarmKit protobuf files
├── docs/ # Architecture and deployment documentation
└── docker-swarm-reference/ # Original SwarmKit (Go) for reference
swarm-core – Core data model (nodes, services, tasks, networks, secrets, configs), state management with change notifications, and constraint-based spread schedulerswarm-consensus – Raft consensus layer with OpenRaft integration, sled-backed log/state storage, and command replicationswarm-manager – Manager node implementation with Control and Dispatcher gRPC services, orchestration loop, and cluster reconciliationswarm-agent – Worker node agent with Docker executor, task lifecycle management, status reporting, and persistenceswarm-node – Lightweight read-only view of node-specific cluster stateswarm-cli – Binary entry points for demo mode and manager/agent processesswarm-proto – Tonic-generated gRPC bindings from SwarmKit protobuf definitionsswarm-store – Sled-backed snapshot store for cluster state persistenceprotoc-bin-vendored provides the compiler during buildRun an in-memory demo to explore RustSwarm without persistence:
cargo run -p swarm-cli -- demo
This starts an interactive demo that creates services, schedules tasks, and demonstrates the orchestration loop.
Start a manager node with persistence and gRPC API:
cargo run -p swarm-cli -- manager
Default configuration:
127.0.0.1:50051./.rustswarm/state/Custom configuration:
cargo run -p swarm-cli -- manager \
--bind 0.0.0.0:50051 \
--state-dir /var/lib/rustswarm
cargo run -p swarm-cli -- manager \
--cluster-mode \
--bootstrap \
--node-id 1 \
--raft-addr 192.168.1.10:50051 \
--bind 192.168.1.10:50051 \
--state-dir /var/lib/rustswarm/node1
# Manager 2
cargo run -p swarm-cli -- manager \
--cluster-mode \
--join 192.168.1.10:50051 \
--node-id 2 \
--raft-addr 192.168.1.11:50051 \
--bind 192.168.1.11:50051 \
--state-dir /var/lib/rustswarm/node2
# Manager 3
cargo run -p swarm-cli -- manager \
--cluster-mode \
--join 192.168.1.10:50051 \
--node-id 3 \
--raft-addr 192.168.1.12:50051 \
--bind 192.168.1.12:50051 \
--state-dir /var/lib/rustswarm/node3
For detailed deployment instructions, see docs/MULTI_NODE_DEPLOYMENT.md.
cargo test
cargo test -p swarm-core
cargo test -p swarm-consensus
cargo test -p swarm-manager
cargo test -p swarm-consensus --test multi_node_cluster
# Format code
cargo fmt --all
# Run linter
cargo clippy --all-targets --all-features
# Check for issues
cargo check --all-targets --all-features
cargo build --release -p swarm-cli
The binary will be available at target/release/swarm-cli.
This project is a clean-room implementation inspired by Docker SwarmKit. See the original SwarmKit project at github.com/moby/swarmkit.
This is a production-grade rewrite following SwarmKit’s design. When contributing:
docker-swarm-reference/ for design and behavior referenceRustSwarm is inspired by and compatible with Docker SwarmKit, the original Go implementation of Docker Swarm mode.