I found those commands useful during my first weeks using Docker. Hopefully, you will find it useful as well.
Docker and Git have in common one cool feature: you can use only part of a container hash code. For example instead of
5e7fc43
you can use just5e7
Check all running containers
docker ps -a
Check created networks
docker network ps
Show all images
docker images
Login into a container as a root user
docker exec -u 0 -it CONTAINER_ID /bin/bash
Execute a command on a container without logging in
docker exec -it CONTAINER_ID cat /etc/krb5.conf
Copy a file to/from a container
The code below will copy hosts file from a container into a current directory on your local machine
docker cp CONTAINER_ID:/etc/hosts hosts
Use docker-compose for setting up environments with two or more intercommunicating containers
It does not only have better human-readable syntax but also adding a default network for those containers