
Every developer should know essential docker commands every developer should know for building images, running containers and debugging deployments. This guide covers practical docker commands every developer should know with examples you can use daily across any stack.
Learning the basics of docker is easy and practical. We recommend every backend and frontend developer to spend time mastering docker commands every developer should know and give their career a boost. Pair this with how to dockerize a Java application and the Linux commands every developer should know for a complete terminal foundation, and see our Git cheat sheet for version-control workflows.
What is Docker?
Docker is a tool designed to make the life of developers and DevOps easier. It easily creates, deploys, and runs applications by using containers.
Docker Containers allow a developer to package up an application with all of the parts it needs, such as libraries, frameworks, and other dependencies, and deploy it as one package.
This package can be saved as a docker image on the Docker hub/repository. By doing so, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that the machine might have that could differ from the machine used for writing and testing the code.
Today we will be listing down some Most Basic Docker Commands.
Most Basic Docker Commands
Docker Images
docker pull
Pull an image or a repository from a registry. This command will pull the image from the docker hub repository.
docker pull {image_name}:{image_tag}
docker pull openjdk
$ docker pull openjdk Using default tag: latest latest: Pulling from library/openjdk bce8f778fef0: Pull complete 2778faef3420: Pull complete 945a8b67ac57: Pull complete Digest: sha256:7397559527629078208a97b883639be6202c6cd51f287894118f5670745924a9 Status: Downloaded newer image for openjdk:latest
docker images
List all the docker images already pulled from the hub.
docker images
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE wordpress latest 3065c9654888 20 hours ago 543MB tomcat latest 2ae23eb477aa 21 hours ago 647MB openjdk latest 0cd6de5fdbee 8 days ago 511MB
docker rmi
The command will remove the image. The image must not be in use by any container.
docker rmi {image_name}:{image_tag}
docker rmi adevguide/AnalysisDash:1.0
docker build
Build/create an image (with given name and tag) from a Dockerfile (from path provided).
docker build -t {imagename}:{image_tag} {path of root of project}
docker build -t AnalysisDash:latest .
docker push
The command will push the image to the docker hub. After the push to the repo, the image will be available for everyone with access. Hub authentication is required before pushing the image.
docker push {repo/image_name}:{image_tag}
docker push adevguide/AnalysisDash:1.0
Docker Containers
docker create
The command will create a new container from the image.
docker create {image_name}
docker create adevguide/AnalysisDash:1.0
docker ps
The command will list all the active/running containers.
The below command will list all the containers.
docker ps -a
See also how to dockerize a Java application with Maven and Dockerfile for a step-by-step build example.
docker run
The command will run/start a new container.
docker run {options} {image_name/id}
The below command will run a container from an image “AnalysisDash” in an interactive mode.
docker run -it adevguide/AnalysisDash:1.0
docker start
The command will start an inactive/stopped container.
docker start {container_id/name}
docker start 6h2t11yf5sc9f
docker stop
The command will stop an active/running container.
docker stop {container_id/name}
docker stop 6h2t11yf5sc9f
docker rm
The command will remove a container.
docker rm {container_id/name}
docker rm 6h2t11yf5sc9f
docker exec
The command will execute a process/command in a running container
docker exec {options} {container_id/name} {command}
docker exec -it 6h2t11yf5sc9f pwd
When exposing services, port mapping with docker run -p must match your app configuration — see changing server port in Spring Boot for a concrete example of aligning container ports with application ports.
docker commit
The command will create a new image from the current state of the container.
docker commit {container_id} {image_name}:{tag}
docker commit 6h2t11yf5sc9f adevguide/AnalysisDash:1.0
References
That’s all the Most Basic Docker Commands Every Developer Should Know. Which docker command you use most often? Did we miss any important command? Do let us know in the comments below. For more tooling guides, browse the DevOps hub and the full hubs overview.
YouTube Videos
-
“Docker Commands Every Developer Must Know – Complete CLI Reference 2026” https://www.youtube.com/watch?v=LYXj6ECDzvI
-
“Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers” https://www.youtube.com/watch?v=fqMOX6JJhGo
-
“Learn Docker in 7 Easy Steps - Full Beginner’s Tutorial” https://www.youtube.com/watch?v=gAkwW2tuIqE