Commands

🐋 docker

docker ps

The first command. List running containers. Link.

docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
52b0774f0050        ranking_web            "python /mnt/host/ma…"   43 hours ago        Up 20 hours         0.0.0.0:8080->8080/tcp   ranking_web_1
6e4fd256538a        postgres:11.1-alpine   "docker-entrypoint.s…"   43 hours ago        Up 20 hours         0.0.0.0:5432->5432/tcp   ranking_db_1

docker ...

🐳 docker-compose

Command line reference here.

exec <container> <command>

This runs a <command> in a <container>. This example runs the bash command ls in the db container. I assume - I haven't actually tested it lolol.

docker-compose exec db bash "ls"

down --rmi all

Stops all running containers maybe?

$ docker ps
# Two containers
CONTAINER ID    ...   NAMES
52b0774f0050    ...   ranking_web_1
6e4fd256538a    ...   ranking_db_1

$ docker-compose down --rmi all
# Kills the things
Stopping ranking_web_1 ... done
Stopping ranking_db_1  ... done
Removing ranking_web_1      ... done
Removing ranking_db_1       ... done
Removing ranking_notebook_1 ... done
...
Removing image ranking_web
Removing image srs/jupyter

$ docker ps
# Nothing!
CONTAINER ID    ...   NAMES