DevOps

Docker Common Commands Cheatsheet

Docker CLI provides a comprehensive set of commands. Here is a quick cheat sheet of the commonly used commands:
 
 
 
 
 
 
 
 
 
 

PurposeCommand
Build an imagedocker build –rm=true .
Install an imagedocker pull ${IMAGE}
List of installed imagesdocker images
List of installed images (detailed listing)docker images –no-trunc
Remove an imagedocker rmi ${IMAGE_ID}
Remove all untagged imagesdocker rmi $(docker images | grep “^” | awk “{print $3}”)
Remove all imagesdocker rm $(docker ps -aq)
Run a containerdocker run
List containersdocker ps
Stop a containerdocker stop ${CID}
Find IP address of the containerdocker inspect –format ‘{{ .NetworkSettings.IPAddress }}’ ${CID}
Attach to a containerdocker attach ${CID}
Remove a containerdocker rm ${CID}
Remove all containersdocker 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.

Arun Gupta

Arun is a technology enthusiast, avid runner, author of a best-selling book, globe trotter, a community guy, Java Champion, JavaOne Rockstar, JUG Leader, Minecraft Modder, Devoxx4Kids-er, and a Red Hatter.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Santhosh Kumar Tekuri
Santhosh Kumar Tekuri
9 years ago

“docker rm $(docker ps -aq)” does not remove all images.
it removes containers

Back to top button