What is Docker? It is an open platform that packages an application together with its libraries, settings and dependencies into a lightweight unit called a container, so the application behaves the same way on every machine. If you have ever heard a developer say “but it works on my laptop”, Docker is the tool built to end that conversation. This beginner friendly guide explains how Docker works, the main terms, the commands you will use first, and where it fits in a DevOps career.

Table of Contents
What is Docker Solving? Why It Was Needed
Software rarely runs on its own. A web application may need a particular Python or Java version, several libraries, environment variables and a web server. A developer sets all of this up on a laptop, then a tester repeats it on a test server, and an operations engineer repeats it again in production. Small differences between those machines cause errors that are slow and frustrating to trace.
Docker solves this by letting you describe the environment once, in a text file, and build a package from it. The same package is then tested and deployed, so there are far fewer surprises between stages.
Containers vs Virtual Machines
To understand what is Docker doing differently, compare it with a virtual machine. A virtual machine imitates a complete computer. Each one carries its own guest operating system, which takes gigabytes of disk space and often minutes to boot. A container shares the kernel of the host operating system and isolates only the application and what it needs. Containers are therefore usually much smaller and start in seconds.
This does not make virtual machines obsolete. They offer stronger isolation and can run a different operating system from the host. In many companies, containers run inside virtual machines in the cloud.

What is Docker Made Of? Key Terms
- Dockerfile: a text file containing the instructions to build your application environment.
- Image: a read-only template built from a Dockerfile.
- Container: a running instance of an image. You can start many containers from one image.
- Registry: a place to store and share images, such as Docker Hub.
- Volume: storage that keeps data even after a container is removed.
- Docker Engine: the service that builds images and runs containers.

A Simple Docker Example
To see what is Docker doing in practice, imagine a small Python web app in a file called app.py, with its libraries listed in requirements.txt. A Dockerfile for it could look like this:
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["python", "app.py"]FROM picks a base image. WORKDIR sets the working folder. COPY brings your files into the image, RUN installs the libraries, EXPOSE documents the port, and CMD says what to run when the container starts.
Build the image and run it:
docker build -t my-app .
docker run -d -p 5000:5000 --name web my-appIf your app listens on port 5000 on all network interfaces (0.0.0.0), you can now open http://localhost:5000 in your browser.
Basic Docker Commands to Practise
docker pull nginx # download an image
docker images # list local images
docker ps # list running containers
docker ps -a # include stopped containers
docker logs web # read a container's output
docker exec -it web sh # open a shell inside it
docker stop web # stop the container
docker rm web # remove the stopped containerFor more detail, see the official Docker get started guide. These commands show what is Docker like in daily work. Do not try to memorise everything at once. Run each command on a practice machine, read the output, and break things on purpose so you learn how to fix them.
What is Docker Used For in DevOps?
Docker is a common building block in automated delivery. When a developer pushes code, a pipeline can build an image, run tests inside it, push it to a registry and deploy that same image to a server. If you are new to this flow, read our guide on what a CI/CD pipeline is.
When an application grows to many containers across several servers, teams use an orchestrator such as Kubernetes to schedule, scale and restart them. For multi-container projects on a single machine, Docker Compose lets you define a web app and its database in one YAML file and start both with docker compose up.
What is Docker Doing Behind the Scenes?
Docker uses a client and server design. When you type a command, the Docker client sends a request to a background service called the Docker daemon. The daemon does the real work: it downloads images, builds new ones, creates containers and manages networks and storage.
On Linux, containers rely on features built into the kernel. Namespaces give each container its own view of processes, network interfaces and file systems. Control groups limit how much CPU and memory a container can use. Docker puts a friendly interface on top of these features.
On Windows and macOS, Docker Desktop runs Linux containers inside a lightweight virtual machine. You use the same commands, even though your laptop runs a different operating system.
Images and Layers Explained
An image is made of layers stacked on top of each other. Instructions in a Dockerfile that change the file system, such as RUN and COPY, create new layers. Docker saves these layers in a build cache and reuses them when nothing has changed.
This is why the order of instructions matters. In the earlier example we copied requirements.txt and installed libraries before copying the rest of the code. When you edit only your code, Docker reuses the installed libraries and the build finishes much faster.
When a container starts, Docker adds a thin writable layer above the read-only image layers. Anything written there disappears when the container is removed, so important data belongs in a volume.
How to Install Docker for Practice
Beginners on Windows or macOS usually install Docker Desktop from the official website. On Linux you can install Docker Engine by following the instructions for your distribution. After installation, check that everything works:
docker --version
docker run hello-worldThe second command downloads a tiny test image and prints a welcome message. If you see a permission error on Linux, read the official post-installation steps. Adding a user to the docker group gives that user powerful, root-level access, so understand this before you do it.
Saving Data with Volumes
Databases need data that survives restarts and upgrades. A named volume is storage managed by Docker that lives outside the container.
docker volume create pgdata
docker run -d --name db \
-e POSTGRES_PASSWORD=change-me \
-v pgdata:/var/lib/postgresql/data \
postgres:16You can remove this container and create a new one with the same volume, and your tables will still be there. The password shown is only a placeholder for practice. Real projects should keep secrets in a secrets manager or protected environment settings.
A bind mount is another option. It connects a folder on your computer to a folder inside the container, which is handy during development because code changes appear immediately.
Docker Networking Basics
Each container gets its own network space. Publishing a port, such as -p 8080:80, sends traffic from port 8080 on your machine to port 80 inside the container.
Containers on the same user-defined network can reach each other by name. A web app can connect to a database using the host name db instead of an IP address that may change.
docker network create shop-net
docker network connect shop-net db
docker run -d --name site --network shop-net -p 8080:80 nginxWhat is Docker Compose? A Two Service Example
Typing long run commands soon becomes tiring. Docker Compose lets you describe all services in a file named compose.yaml and manage them together.
services:
web:
build: .
ports:
- "5000:5000"
depends_on:
- db
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: change-me
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:Run docker compose up -d to start both services and docker compose down to stop and remove the containers. The named volume stays unless you ask Docker to delete it. Note that depends_on controls start order, but by itself it does not wait until the database is ready to accept connections.
What is Docker Troubleshooting? Common Beginner Problems
The container exits immediately
A container runs only as long as its main process. Use docker ps -a to see the exit status and docker logs to read the error. A missing file or a wrong start command is a frequent cause.
The port is already allocated
Another program or container is using that port. Stop it, or choose a different port on the left side of the -p option.
The app is running but the page does not open
Check that the application listens on 0.0.0.0 and not only on 127.0.0.1 inside the container. Then confirm that you published the correct port.
Disk space keeps shrinking
Old images and stopped containers add up. The command docker system df shows what is using space. Prune commands can free it, but read the warning carefully, because removed items cannot be recovered.
Docker Security and Best Practices
Start from trusted base images and use specific version tags, so builds do not change unexpectedly. Rebuild regularly to pick up security fixes.
Run the application as a normal user by adding a USER instruction. Keep images small with multi-stage builds, where one stage compiles the code and the final stage contains only what is needed to run it.
FROM node:22 AS build
WORKDIR /app
COPY . .
RUN npm ci && npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/htmlThis example assumes your project writes its build output to a folder called dist.
Docker in a Team Workflow
On your own laptop, an image never has to leave your machine. In a team, it travels. A developer writes code and a Dockerfile, then commits both to Git. Reviewers can see changes to the environment in the same way they see changes to the application.
After the change is merged, a build server creates the image and gives it a tag. Many teams use the Git commit ID or a version number as the tag, so anyone can tell exactly which code is running.
docker build -t myteam/my-app:1.4.0 .
docker login
docker push myteam/my-app:1.4.0Here myteam is a placeholder for your registry account or organisation name. A test server can then pull this tag and run it. Once testing is complete, the very same image is promoted to production, without being rebuilt.
Settings that differ between environments, such as database addresses, should not be baked into the image. Pass them in when the container starts, using environment variables or a configuration service.
docker run -d --env-file test.env myteam/my-app:1.4.0Keep files like test.env out of Git and out of the image if they contain passwords or keys.
Rolling back also becomes simpler. If a new release misbehaves, the team can start the previous tag again. This does not undo changes made to a database, so database updates still need their own careful plan.
Monitoring matters as well. Containers should write logs to standard output, where Docker or a logging platform can collect them. A health check can report whether the application is really responding, which is more useful than knowing that a process exists. The command docker stats gives a quick live view of CPU and memory use while you practise.
Practice Project Ideas
The best way to understand what is Docker capable of is to build something small. Containerise a static website with nginx. Next, package a simple API with a database using Compose. Finally, create a pipeline that builds your image every time you push to Git.
Write a short README for each project explaining how to run it. In an interview, being able to walk through your own Dockerfile and describe the problems you fixed is far more useful than reciting definitions.
Quick Revision: What is Docker in Simple Words?
So, what is Docker in one line? It is a way to pack an application with everything it needs and run it consistently. If a friend asks what is Docker useful for, mention consistent environments, quicker setup and easier deployment.
Before moving ahead, test yourself. Can you explain what is Docker, build an image, publish a port, keep data in a volume and read container logs? If yes, you are ready for orchestration.
How to Start Learning Docker
Once you can answer “what is Docker” in your own words, follow these steps.
- Learn basic Linux commands, file permissions and networking.
- Install Docker and run ready-made images such as nginx.
- Write a Dockerfile for a small project of your own.
- Add volumes and networks, then try Docker Compose.
- Connect your build to Git and a CI tool, and move on to Kubernetes.
Knowing what is Docker is only the first step, and good habits matter from the start: use small official base images, add a .dockerignore file, never store passwords inside an image, and avoid running containers as the root user where possible.

Frequently Asked Questions
What is Docker pricing? Is it free to use?
Docker Engine is open source. Docker Desktop is free for personal use, education and many small businesses, while larger organisations need a paid subscription. Check Docker’s current terms before using it at work.
Do I need coding skills to learn Docker?
You do not need to be an expert programmer. Comfort with the command line and a basic idea of how applications run are enough to begin.
What is the difference between an image and a container?
An image is the blueprint. A container is a running copy created from that blueprint.
Is Docker the same as Kubernetes?
No. Docker is mainly used to build and run containers. Kubernetes manages containers across a cluster of machines.
Learn Docker with LavaTech in Pune
Now that you know what is Docker, remember that reading is a good start, but hands-on practice is what builds confidence. LavaTech Technology’s DevOps course in Pune is offered in a hybrid format, with online and classroom learning at Karve Road, so you can practise containers alongside Linux, Git and delivery pipelines. Visit the course page to check the syllabus and upcoming batches, and contact our team with your questions.