What is Docker?
Docker packages your application together with everything it needs to run — the code, the runtime, the libraries, the settings — into a single unit called a container. That container runs identically on your laptop, your colleague's machine, and the production server. It ends "but it works on my machine."
When should you use it?
Use Docker when you want your app to run the same everywhere, when your app needs specific versions of things, when you are running multiple services together, or when you are deploying to the cloud. It is close to essential for modern backend development.
How to set it up
Install Docker Desktop (Mac/Windows) or Docker Engine (Linux). You write a Dockerfile describing how to build your app's image, then docker build and docker run.
How it connects to your code
A Dockerfile defines your container. docker-compose.yml defines several containers running together (your app + its database). Most projects on The Codex include a Dockerfile you can copy.