Docker Commands Cheat Sheet (Swarm Deployment)

Here you'll find a list of Docker and Docker Swarm commands you can use to manage Metric Insights for Swarm (orchestrated environment). 

  1. Deploying
  2. Getting Information
  3. Getting into container
  4. Getting Logs
  5. Removing


1.) Deploying

  • Deploying the swarm:

docker stack deploy -c <deployment manifest>.yml --with-registry-auth <user used for docker login to pull docker images>

 

2.) Getting Information

  •  Get list of Docker Services:

docker services ls

 

  • Check processes for specific Docker Service:

docker service ps <service ID>

 

  • Get more information about a Docker Service:

docker service inspect <service ID>

docker service inspect <service name>

 

  • Get list of running Docker containers on a given node for Docker Swarm (Master or Worker node):

docker node ps <node ID>


  • Get more information about a Docker Container:

docker inspect <container ID>  

docker inspect <container ID>

 

  • Get list of Docker Volumes: 

docker volume ls

 

  • Get list of Docker Networks: 

docker network ls

 

3.) Getting into container

docker exec -it <container ID> bash

4.) Getting Logs

  •  See full process logs for specific Docker Service for Swarm: 

docker service ps --no-trunc <service ID>  

 

  • See Docker Container logs for Docker Swarm:

docker logs <container ID>

docker logs <container name>

5.) Removing

  • Remove Docker Volume: 

docker volume rm <volume ID>

docker volume rm <volume name>

 

  • Remove specific Docker Service:

docker service rm <service ID>

docker service rm <service ID>

 

  • Remove specific Docker Network:

docker network rm <network ID>

docker network rm <network name>

 

  • Remove all Docker Services / entire Stack:

docker stack rm <stack name>