Docker cheat sheet
List of simple commands to use for docker management.
Run a container
docker run container_name
Bash into container
docker exec -it container_name bash
Bash into container as root
docker exec -it --user root container_name bash
Run a command for container, for example, ghost ls
docker exec -it container_name ghost ls
Stop all containers
docker stop $(docker ps -a -q)
Remove all container
docker rm $(docker ps -a -q)
Inspect container IP address
docker inspect --format "{{ .NetworkSettings.IPAddress }}" container_name
Import database into a mysql container
docker exec -i database_container_name mysql -u database_user -pdatabase_password database_name < database.sql
The list will be updated every now and then. Let us know if you are interested in any particular commands.