Docker stuff

Basic commands

List docker containers

docker ps

Restart docker container

docker restart 

Networks

List docker networks

docker network ls

Attach container to network

Example when containers need to communicate on the same network, e.g a proxy manager services needing to communicate on the same network as other containers

docker network connect  

Detach network from container

docker network disconnect  

Gracefully shutdown container with docker compose

docker stop 

This can be done from within the project /dir if using docker compose:

docker compose down 

If the network is attached, use network disconnection above.

Remove all containers within the docker-compose.yml file

For e.g associated services

sudo docker compose down --volumes --remove-orphans

Remove docker images

docker images --> list them
docker rmi 

Gracefully shutdown container w/out docker compose

docker stop 
docker rm 
docker network rm  --> if there's a network

Create shell session in container

sudo docker exec -it  /bin/bash