Docker Commands Cheat Sheet (Simple Install / Single-server / Non-orchestrated)

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

  1. Getting Information
  2. Getting into container
  3. Getting Logs
  4. Restarting/Removing/Stopping/Starting Containers


1.) Getting Information

  • Get a list of running Docker containers (Simple installation):

docker ps 

docker ps -a

 

  • Get more information about a specific Docker Container:

docker inspect <container id>   


  • Get Docker network information:

docker network ls 


  • Get more information about a specific Docker network:

docker network inspect <network name>

2.) Getting into container

docker exec -it <container ID> bash

Alternatively:

mi-console or mi-web (enter web container)

mi-console dataprocessor or mi-dataprocessor (enter dataprocessor container)

mi-console seed or mi-seed (enter seed container)

mi-console monitoring or mi-monitoring (enter monitoring container)

mi-console data-analyzer or mi-data-analyzer (enter data-analyzer container)

mi-console redis or mi-redis (enter redis container)

mi-console mysql or mi-mysql (enter mysql container, if applicable)

3.) Getting Logs

See Metric Insights Application Logs by going to this directory:

cd /opt/mi/log 


Key logs are:

  • mi.log
  • mi.error
  • mi.debug


Metric Insights Apache Web Service logs are routed to the Web container logs. To view those logs run:

docker logs mi-web-1

4.) Restarting/Removing/Stopping/Starting Containers

mi-control restart (with no arguments, will restart all MI Docker containers)

mi-control restart dataprocessor (will restart just the dataprocessor container -- you can input any service name such as web, seed, monitoring, data-analyzer, etc.)


mi-control stop (stop all MI containers/effectively stopping the MI app)

mi-control start (start all MI containers)


mi-control down dataprocessor (stop the dataprocessor container -- you can input any service name such as web, seed, monitoring, data-analyzer, etc.)


mi-control rm --stop dataprocessor seed (Removing dataprocessor and seed containers because they are stuck in some undesired state -- this is 1st step to redeploy a container. You can input any service name such as web, seed, monitoring, data-analyzer, etc.)

mi-control up -d dataprocessor seed (Redeploying dataprocessor and seed from the base Docker image because they are stuck in some undesired state -- this is 2nd step to redeploy a container. You can input any service name such as web, seed, monitoring, data-analyzer, etc.)


service docker stop (stop Docker service)

service docker start (start Docker service)