Some useful docker commands

Attach to a container

docker exec -i -t container_name /bin/bash

List images

docker image ls

List all existing containers

docker ps -a

Delete a image

docker image rm image_name

Delete all images

docker image rm $(docker images -a -q)

Stop a container

docker stop container_name

Stop all running containers

docker stop $(sudo docker ps -a -q)

Delete a container

docker rm container_name

Delete all containers

docker rm $(docker ps -a -q)

Display logs of a container

docker logs container_name