Docker CLI provides a comprehensive set of commands. Here is a quick cheat sheet of the commonly used commands:
| Purpose | Command |
|---|---|
| Build an image | docker build –rm=true . |
| Install an image | docker pull ${IMAGE} |
| List of installed images | docker images |
| List of installed images (detailed listing) | docker images –no-trunc |
| Remove an image | docker rmi ${IMAGE_ID} |
| Remove all untagged images | docker rmi $(docker images | grep “^” | awk “{print $3}”) |
| Remove all images | docker rm $(docker ps -aq) |
| Run a container | docker run |
| List containers | docker ps |
| Stop a container | docker stop ${CID} |
| Find IP address of the container | docker inspect –format ‘{{ .NetworkSettings.IPAddress }}’ ${CID} |
| Attach to a container | docker attach ${CID} |
| Remove a container | docker rm ${CID} |
| Remove all containers | docker rm $(docker ps -aq) |
What other commands do you use commonly ?
| Reference: | Docker Common Commands Cheatsheet from our JCG partner Arun Gupta at the Miles to go 2.0 … blog. |
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Thank you!
We will contact you soon.
Tags
Docker
👁 Photo of Arun Gupta
Arun GuptaDecember 2nd, 2014Last Updated: December 1st, 2014
Arun GuptaDecember 2nd, 2014Last Updated: December 1st, 2014
1 50 1 minute read

This site uses Akismet to reduce spam. Learn how your comment data is processed.
“docker rm $(docker ps -aq)” does not remove all images.
it removes containers