Created Wed Aug, 21 2019 at 12:23PM

See what docker containers are running

docker ps

See all processes even stopped processes

docker ps -a

Running a container in detached mode (background)

docker run -d <container>

Docker container run -d -p 3306:3306 name MySQL env MYSQL_ROOT_PASSWORD=foo123 MySQL

remove all docker containers not running

This does not remove volumes. You'll have to remove those separately.

sudo docker system prune

removing unused docker volumes

# list docker volumes
sudo docker volume ls
# remove docker volumes not running
sudo docker volume prune
# remove docker volumes not running (all stopped & down)
sudo docker volume prune -a
# to remove multiple volumes 
sudo docker volume rm owncloud_backup owncloud_files owncloud_mysql owncloud_redis

run interactive shell on container

# first find it's container id or name if given one
sudo docker ps
sudo docker run -it f93361286737 /bin/bash

interactive shell with a docker-compose image

sudo docker-compose ps
sudo docker exec -ti <docker name> /bin/bash
sudo docker-compose down && sudo docker-compose rm --force && sudo docker-compose pull && sudo docker-compose build --pull && sudo docker-compose up --force-recreate --build

Docker login

If you get an X11 error :

sudo apt install gnupg2 pass