Docker turns “works on my machine” into “works everywhere”
Docker wraps your code, runtime, libraries and settings into one portable container. Build it once, then start the very same thing on a laptop, a test server or a production cluster.
Free for personal use, learning, education and open source projects.
$ docker run -d -p 8080:80 nginx Unable to find image 'nginx:latest' locally latest: Pulling from library/nginx Status: Downloaded newer image for nginx:latest 3f9c1e7a52b4d0c8… $ docker ps CONTAINER ID IMAGE STATUS PORTS 3f9c1e7a52b4 nginx Up 4 seconds 0.0.0.0:8080->80/tcp
What Docker actually is
Docker is an open platform for packaging software into isolated units called containers. Three ideas carry the whole tool, and once they click, the rest of Docker feels obvious.
Image
A read-only template that holds your application, its dependencies and a minimal filesystem. You describe it in a short text file called a Dockerfile and Docker builds the layers for you.
Container
A live, isolated process created from an image. It has its own network, files and process list, starts in about a second and disappears without leaving a mess on the host.
Registry
A place to store and share images. Pull a ready-made database or web server in one command, or push your own build so a teammate and your servers can run it too.
Containers vs virtual machines
Both isolate workloads, but they do it at a different level, which changes size, speed and density.
| Question | Docker container | Virtual machine |
|---|---|---|
| What is inside | App plus its libraries | Full guest operating system |
| Typical size | Tens to hundreds of MB | Several GB |
| Start time | Around a second | Often a minute or more |
| Kernel | Shared with the host | Separate per machine |
| Best for | Microservices, CI jobs, dev environments | Different OS kernels, strict hardware isolation |
Who gets the most out of Docker
Different roles use the same tool for different reasons.
Developers
Spin up PostgreSQL, Redis or a message queue next to your code without installing anything globally. Delete the container and your machine is clean again.
DevOps and platform teams
Deploy identical artifacts through test, staging and production. Rollbacks become a matter of starting the previous image tag.
QA engineers
Recreate a customer’s exact stack from an image, run browser tests in disposable containers and throw the environment away after each run.
Students and hobbyists
Try Linux tools, programming languages and self-hosted apps in a safe sandbox. A bad experiment costs one command to undo.
From idea to running service in four moves
The everyday Docker routine is short. Here is the path almost every project follows.
-
1
Write a Dockerfile
List the base system, copy your code in, install what it needs and say how to start it. Ten lines is often enough for a small web app.
-
2
Build the image
Run docker build and Docker produces a tagged image. Unchanged layers are cached, so the second build takes seconds instead of minutes.
-
3
Run it locally
Start a container with docker run, open the mapped port in a browser and test the real thing, not a loose approximation of it.
-
4
Ship it
Push the image to a registry and pull it on any host with Docker installed. The environment travels together with the code, so nothing is reinstalled by hand.
Ready to run your first container?
Install Docker, paste one command and watch a web server come alive in seconds.
Docker questions, answered
Is Docker free to use?
Docker Engine and the command line are open source. Docker Desktop is free for individuals, students, educators, open source projects and small businesses; larger companies need a paid subscription.
Do I need to know Linux to start?
No. A handful of commands such as run, ps, logs and stop cover the basics. Linux knowledge helps later, but you can learn it while you build.
Will Docker slow my computer down?
Containers share the host kernel, so idle ones use very little. You can cap memory and CPU per container and stop everything with a single command.
Can I run Docker on Windows and Mac?
Yes. Docker Desktop runs a lightweight Linux environment behind the scenes, so Linux containers work the same on Windows, macOS and Linux.
What is the difference between an image and a container?
An image is the frozen template. A container is a running copy of it. One image can launch as many containers as you like.