Deep Dive: How SwarmCLI Simplifies Docker Swarm Operations for DevOps Teams
Source: Dev.to
Docker Swarm continues to power production environments thanks to its minimal overhead and native Docker integration. Tools that enhance its usability are in high demand, and SwarmCLI—an open‑source CLI tool comparable to k9s for Swarm—offers a streamlined experience for DevOps teams.
The Core Workflow: From Setup to Scaling
Stacks and Services
- List stacks:
docker stack ls - List services in a stack:
docker stack services <stack_name> - Inspect configurations, ports, and other details directly from the CLI.
Scaling and Rollbacks
-
Adjust replicas on the fly:
docker service scale <service_name>=<replica_count> -
Roll back a bad deployment:
docker service update --rollback <service_name> -
Immediate error overviews flag issues instantly.
Logs and Tasks
-
Tail logs for a service:
docker service logs -f <service_name> -
Check task status:
docker service ps <service_name>
These commands can be accessed without leaving the SwarmCLI interface, making live debugging faster.
Nodes and Networks: Infrastructure at Your Fingertips
Node Management
- List nodes:
docker node ls - Promote or demote managers
- Add labels or safely delete nodes
Network Ops
-
Create, inspect, prune, or delete networks:
docker network create <network_name> docker network inspect <network_name> docker network prune docker network rm <network_name>
Configs and Secrets (CRUDE)
- Create, read, update, delete, and inspect configs and secrets.
- The “Reveal” feature for secrets is planned for the Business Edition.
Contexts: Multi‑Env Mastery
Switch between development, staging, and production environments seamlessly:
docker context use <context_name>
docker context export <context_name> > <file_path>
docker context import <file_path>
Real‑Use Case: Debugging a Failing Service
- List services and identify the problematic one.
- View tasks and stream logs in real time.
- Scale down, roll back, or restart the service within seconds.
- Check node health to rule out hardware issues.
This workflow saved our team hours compared to using the native Docker CLI alone.
Installation & Contribution
- Official site:
- GitHub repository:
Feel free to install, explore, and contribute to the project.