7.5 Managing a Docker Swarm
You should become familiar with Docker Swarm official documentation on how a Docker Swarm operates. But the following docker commands are helpful when SSH'ing into your manager node to debug infrastructure issues.

docker service ls

docker service scale <service name e.g.: "opencrvs_metrics">=1

docker stack ps opencrvs —no-trunc

docker service logs <service name e.g.: "opencrvs_metrics">

You need to check Docker swarm for the id of the containers running mongo, elasticsearch or resources in order to access To find which node hosts the container you are looking for, run this command on the manager node.
docker stack ps -f "desired-state=running" opencrvs
After running the previous command to discover which node is running a container, SSH into the right node and run the following to get the container id
docker ps

docker logs -f <container id e.g. "opencrvs_user-mgnt.1.t0178z73i4tjcll68a7r72enu">

docker exec -it <container-id> <command e.g. "ls", "mongo", "printenv", "influxd">
Running
netstat -plant
Inside a container will tell you which ports are open and listening

docker ps # to get the container id
docker inspect <container id e.g. "opencrvs_user-mgnt.1.t0178z73i4tjcll68a7r72enu">

docker service rollback opencrvs_user-mgnt

Copy link
On this page
To check the status of all running services