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

Author: Thomas Faddegon

Do you like my posts and want to do something back? You can buy me a beer :)