Some useful Docker commands

Docker is a great tool for building and shipping apps. At /e/OS the organization were I work we use it to build our officially supported Smartphone OS.
I used to build ROM’s using the traditional Repo Sync way , writing commands and waiting for them to execute. After trying out Docker I have now become a fan!
Docker combines all the commands and executes them without you having to interfere in the process.

These are a set of commands I find very useful when executing or using Docker containers.

Command to Stop all running containers
(use with caution)

docker stop $(docker ps -aq)

Command to Delete all containers

(use with caution)

docker rm $(docker ps -a -q)

Command to Delete all images

(use with caution)

docker rmi $(docker images -q)

Command to Show all images

docker image ls

Command to Remove image by id

You can retrieve the image ID by executing the previous command

docker rmi 75f08d5b848d

Here the 75f08xxxx you see in the command above is an image id retrieved by the above command

Interested in learning more about Docker ? Try out this tutorial

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s