Frequently Used Docker Commands

Here is the list of frequently used docker commands:
(You can find the full list in the official documentation )

List All Images

docker image ls -a

Remove All images

docker rmi $(docker images -q)

List All Containers

docker ps -aq

Stop All Running Containers

docker stop $(docker ps -a -q)

Remove  All Exited Containers

docker rm $(docker ps -q -f status=exited)

Remove All Running Containers

docker rm -f $(docker ps -a -q)

Remove All Unused Data(Unused containers, Images, Networks and Volumes)

docker system prune

Check Inside A Container

docker ps -aq  (lists all container ids)
e.g:
78ad7c6f87dd
6df1eda50edc

c1328da109d7

docker exec -it    bash
e.g:
docker exec -it  78ad7c6f87dd  bash

Comments

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.