Docker is like a virtual box that lets you put your app inside and run it without worrying about messing up your computer. It’s like having a bunch of separate little rooms where you can run different apps at the same time without them bothering each other. Each room (or container) is lightweight and has everything your app needs to work, so you don’t have to worry about what’s already on your computer. Plus, you can easily share these containers with others, making sure everyone has the same setup.

Install Docker

Get the latest version from Docker official site.

Some sample projects


#Build an Image from a Dockerfile
docker build -t
#Build an Image from a Dockerfile without the cache
docker build -t . –no-cache
#List local images
docker images
#Delete an Image
docker rmi
#Remove all unused images
docker image prune

Docker hub

Service platform provided by Docker to store and share container images.

#Login into Docker
docker login -u <username>
#Publish an image to Docker Hub
docker push <username>/<image_name>
#Search Hub for an image
docker search <image_name>
#Pull an image from a Docker Hub
docker pull <image_name>

Help commands

#Start the docker daemon
docker -d
#Get help with Docker. Can also use –help on all subcommands
docker --help

This one is very cool. It tells you all details about your system:

#Display system-wide information
docker info


A container is like a special environment created from an image. It always behaves consistently, no matter where it’s running. Containers keep your software separate from its surroundings, making sure it works the same way whether you’re developing, testing, or running it live.

#Create and run a container from an image, with a custom name:
docker run --name <container_name> <image_name>
#Run a container with and publish a container’s port(s) to the host.
docker run -p <host_port>:<container_port> <image_name>
#Run a container in the background
docker run -d <image_name>
#Start or stop an existing container:
docker start|stop <container_name> (or <container-id>)
#Remove a stopped container:
docker rm <container_name>
#Open a shell inside a running container:
docker exec -it <container_name> sh
#Fetch and follow the logs of a container:
docker logs -f <container_name>
#To inspect a running container:
docker inspect <container_name> (or <container_id>)
#To list currently running containers:
docker ps
#List all docker containers (running and stopped):
docker ps --all
#View resource usage stats
docker container stats

I like to keep these commands handy. Sometimes you tend to forget. Contact me if you have any questions or want to collaborate.

Leave a comment

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