🐳Developer

Docker for Developers: What You Actually Need to Know

Docker feels complex until you understand the three core concepts. Here's a practical intro that skips the theory and gets you running containers.

7 min readJanuary 22, 2026By FreeToolKit TeamFree to read

Docker clicked for me the moment I stopped thinking about it as 'containers' and started thinking about it as 'reproducible environments.' The problem Docker solves is real: 'works on my machine' is useless when you're collaborating or deploying. Docker makes environments explicit and repeatable.

The Three Concepts That Actually Matter

Everything in Docker flows from three things: images (blueprints), containers (running instances), and Dockerfiles (instructions to build an image). That's it. Everything else — volumes, networks, Docker Compose — is built on these.

Your First Dockerfile

A Dockerfile is a text file with sequential build instructions. Each instruction creates a layer in the image. Here's a realistic Node.js Dockerfile:

  • FROM node:20-alpine — start from an official Node.js image (Alpine = small)
  • WORKDIR /app — set working directory inside the container
  • COPY package*.json ./ — copy dependency manifests first
  • RUN npm ci — install dependencies (this layer is cached when dependencies don't change)
  • COPY . . — copy your application code
  • EXPOSE 3000 — document which port the app uses
  • CMD ["node", "server.js"] — command to run when container starts

Docker Compose for Local Development

For any project with more than one service, use Docker Compose. A simple web app with a database becomes two services in docker-compose.yml: your app and a PostgreSQL container. Define both, run docker-compose up, and they start together on the same network. No manual network configuration, no port conflicts, no 'which postgres am I connecting to.'

The Commands You'll Use 90% of the Time

  • docker-compose up -d — start all services in the background
  • docker-compose down — stop and remove containers
  • docker-compose logs -f [service] — tail logs from a service
  • docker ps — list running containers
  • docker exec -it [container] sh — open a shell inside a running container
  • docker build -t myapp . — build an image from current directory

Common Gotchas to Avoid

Layer caching is Docker's superpower but also its footgun. If you COPY your entire project before installing dependencies, npm install runs every time any file changes. Always copy package.json first, install dependencies, then copy the rest. This way the dependency layer is cached as long as package.json doesn't change.

Use .dockerignore

Create a .dockerignore file (same syntax as .gitignore) to exclude node_modules, .git, and other large directories from the build context. This dramatically speeds up builds and reduces image size.

Frequently Asked Questions

Do I need Docker as a frontend developer?+
Increasingly, yes — but not for everything. Docker is most useful for running backend services locally (databases, Redis, third-party APIs) without installing them on your machine. If your frontend project needs a database for local development, Docker Compose makes spinning up that database trivial. Many modern development environments also ship as Docker containers for consistency across team members. You don't need to build Docker images yourself, but knowing how to use docker-compose up is genuinely valuable.
What's the difference between a Docker image and a container?+
An image is a blueprint — a read-only template that defines what a container will look like. A container is a running instance of an image. Think of an image like a class in programming, and a container like an instance of that class. You can run multiple containers from the same image. Images are built from a Dockerfile. Containers are created with docker run. Images live on disk; containers run in memory (with their own filesystem layer on top of the image).
Is Docker Compose different from Docker?+
Docker Compose is a tool that sits on top of Docker. While Docker deals with individual containers, Docker Compose manages multi-container applications defined in a YAML file. Instead of running multiple docker run commands with networking flags, you define all your services (web app, database, cache) in a docker-compose.yml file and start everything with one command: docker-compose up. It's almost always what you want for local development environments.
How is Docker different from a virtual machine?+
Virtual machines emulate entire hardware. Docker containers share the host operating system's kernel. This makes containers much lighter — they start in seconds instead of minutes and use far less memory. A VM running Ubuntu might need 1-2GB of RAM. A Docker container running the same application might need 50MB. The tradeoff: containers don't provide the same isolation as VMs. For most development and deployment use cases, container isolation is sufficient. VMs are better for running different operating systems or workloads requiring strict isolation.

🔧 Free Tools Used in This Guide

FT

FreeToolKit Team

FreeToolKit Team

We build free browser-based tools and write practical guides that skip the fluff.

Tags:

developerdockerdevopscontainers