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-web (enter web container)

mi-dataprocessor (enter dataprocessor container)

mi-image-generator (enter image-generator container)

mi-console (enter console container)

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

mi-redis (enter redis container)

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, console, 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, console, image-generator, data-analyzer, etc.)


mi-control rm --stop dataprocessor data-analyzer (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, image-generator, console, data-analyzer, etc.)

mi-control up -d dataprocessor data-analyzer (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, image-generator, console, data-analyzer, etc.)


service docker stop (stop Docker service)

service docker start (start Docker service)