Docker Commands Cheat Sheet

Here you'll find a list of Docker and Docker Swarm commands you can use to manage Metric Insights, whether it's a simple deployment or a 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 (Simple installation):

docker ps

docker ps -a

  • 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

  • For Simple installation:


 docker exec -it <container name or ID> sh  

  • For Docker Swarm and AWS ECS (while being on ECS worker):

 docker exec -it <container ID> bash

4.) Getting Logs

  •  See full process logs for specific Docker Service: 

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


  • See Docker Container logs:

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>