Docker commands cheat sheet

By | November 15, 2017

Welcome to world of Docker. Docker is such a blessing for DevOps folks and processes. We still remember days when world is amazed by virtual machines. Oh, I can spin off multiple virtual OSes running on host windows. Virtual machines indeed solved some of the problems. However, they’re clunky, heavy in size.

Docker took us to another granular level of containers & images much thinner then virtual OSes, layered images further reducing the size of images and making deployments easy piece of cake. You can further optimize cost savings with Docker containers. Totally isolated, bootstrapped environment which can run on any docker host with any constraints opens up a whole lot of possibilities.

We’re impressed with Docker. We integrated Docker containers into our workflows. Docker file is an amazing piece of art. Few concise commands in a text file can initialize, build and run a mission critical app in few seconds.

Let’s grasp some useful docker commands. Of course, this list is very small. We’ll keep adding as we learn more and more

Docker CommandDescription
Docker pslist of running containers
DOCKER RM [ID]removes container with specific ID
DOCKER Images lslist of all containers
DOCKER STOP [ID]stops container
docker build -t api -f testapp/Dockerfile . &&  docker run -it -p 9000:9000 apiBuilds a container using specific docker file and runs containers on a specific port
docker run -it -p 9000:9000 --entrypoint bash apiRuns a shell in a container that is running

Leave a Reply

Your email address will not be published. Required fields are marked *