Docker commands cheat sheet
Sep 2, 2018 · 1 min read

Here are some of the most used docker commands.
1. Run a container
docker run image-name2. Run a container in detached mode
docker run -d image-name3. Stop all running containers
docker kill $(docker ps -q)4. Delete all stopped containers
docker rm $(docker ps -a -q)5. Delete all images
docker rmi $(docker images -q)6. Force delete all images
docker rmi -f $(docker images -q)7. Port mapping
docker run -p host_port:docker_port image-name8. Volume mapping
docker run -v host_volume:docker_volume image-name9. Run commands inside container
docker exec container-id command10. Go inside container
docker exec -it container-id bash11. Inspect a container (eg. to find internal IP of container, image it is using etc)
docker inspect container-idThis blog is based on my github gist https://gist.github.com/rokinmaharjan/df67d114e84b4ad22b191c85f78c658e .
Thanks for reading. Hope this helps! :)