TR/EN
Blog

What Is Docker? How to Install Docker on Windows, Linux and macOS

Published: · 13 min read

One of the most famous lines in software: "But it worked on my machine!" The app runs fine on the developer's laptop, then blows up on the server because of a different library version, a missing package or a different setting. Docker exists to solve exactly that. In this post we answer what is Docker and what it's for, then walk through installing Docker on Linux, Windows and macOS step by step.

What Is Docker?

Docker is an open-source platform that puts applications, together with everything they need (code, runtime, libraries, settings), into packages called containers, so they run the same way everywhere.

That's where the name comes from: think of shipping containers at a port. Whatever's inside, the container's dimensions are standard; it loads onto a ship, a train or a truck the same way. Docker containers are the same: whether there's Node.js, Python or PHP inside, they run exactly the same on the developer's laptop, the test server and the production server.

Core Docker Concepts

ConceptWhat it means
ImageA ready, read-only package of the app and its environment. Think of it as a template.
ContainerA running instance started from an image. You can start as many containers from one image as you like.
DockerfileA text file describing step by step how to build an image.
Registry / Docker HubWhere images are stored and shared. Docker Hub is the best-known public registry.
VolumePersistent storage that survives container deletion (like database files).
NetworkA virtual network that lets containers talk to each other.
Docker ComposeA tool for managing multiple containers (e.g. app + database) together with one file.

Containers vs Virtual Machines

Both provide isolation, but they work very differently. A virtual machine emulates a whole computer with its own operating system; a container shares the host's kernel and isolates just the application.

Container (Docker)Virtual machine
ContainsApp + librariesA full operating system + app
SizeUsually tens to hundreds of MBUsually several GB
Startup timeSecondsMinutes
Resource usageVery low overheadA separate OS overhead per VM
IsolationProcess level (kernel is shared)Hardware level, stronger
Typical useApp packaging, microservices, CI/CDDifferent operating systems, full isolation

Note: they're not competitors. Most of the time Docker is already running inside a virtual server.

What Is Docker Used For?

  • The same environment everywhere: Development, testing and production are identical; the "works on my machine" era is over.
  • Fast onboarding: A new developer can bring the project up with one command, no database setup headaches.
  • CI/CD: The same image is built and tested on every commit, and that same image goes to production.
  • Microservices: Each service runs in its own container without affecting the others.
  • Resource efficiency: You can run many isolated apps on the same server.

Docker by Platform

One important detail before we install: Docker containers run on the Linux kernel. So on Linux, Docker runs natively, while on Windows and macOS a lightweight Linux virtual machine is used in the background.

PlatformWhat you installHow it runsNote
LinuxDocker EngineNatively, best performanceStandard for servers; open source and free
Windows 10/11Docker DesktopThrough WSL 2 (Windows Subsystem for Linux)Hardware virtualization must be enabled
macOSDocker DesktopA lightweight Linux VM in the backgroundSeparate builds for Apple Silicon (M series) and Intel
License note: Docker Engine on Linux is open source and free. Docker Desktop is free for personal use, education and small businesses; companies above a certain employee count or revenue need a paid subscription. Check the current license terms for business use.

Installing Docker on Linux (Ubuntu)

The package in Ubuntu's own repository can be out of date; the best way is to install from Docker's official repository. First add the repository and install Docker:

sudo apt-get update
sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" \
  | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Test the install and give your user access:

sudo docker run hello-world

# add your user to the docker group so you don't have to type sudo every time
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world

If you see the "Hello from Docker!" message, you're done. On Debian, Fedora or other distributions the steps are similar; only the repository URL and package manager change.

Quick way: For test environments, Docker's official install script does all of this in one go. On production servers the manual install above is recommended because it's more controlled:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Installing Docker on Windows

Requirements: 64-bit Windows 10 or 11, hardware virtualization (Intel VT-x / AMD-V) enabled in BIOS/UEFI, and at least 4 GB of RAM (8 GB or more for comfortable use).

  1. Install WSL 2: Open PowerShell as administrator, run the command below, then restart your computer:
wsl --install
# after restarting, make sure it's up to date
wsl --update
  1. Download Docker Desktop: Download the Docker Desktop installer for Windows from docker.com. You can also install it with winget:
winget install -e --id Docker.DockerDesktop
  1. Finish the install: During setup, make sure "Use WSL 2 instead of Hyper-V" is checked. You may be asked to sign out and back in when it's done.
  2. Start Docker Desktop: When the whale icon in the bottom-right corner stops animating, Docker is running.
  3. Test it: In PowerShell or Windows Terminal:
docker version
docker run hello-world

Installing Docker on macOS

Requirements: A recent version of macOS and at least 4 GB of RAM. The first and most important step: find out your Mac's processor (Apple menu → About This Mac). There are separate installers for Apple Silicon (M1, M2, M3, M4...) and Intel.

  1. Download: Get the Docker Desktop .dmg for your processor from docker.com.
  2. Install: Open the file and drag the Docker icon into the Applications folder.
  3. First launch: Open Docker from Applications and approve the requested permissions. When the whale icon in the top menu bar settles, Docker is ready.

If you use Homebrew, you can install it with a single command:

brew install --cask docker-desktop

Then test it in Terminal:

docker version
docker run hello-world

On Apple Silicon Macs some older images may only be built for Intel (amd64); Docker runs them with emulation, but a bit slower. Prefer images with arm64 support when you can.

First Steps: Basic Docker Commands

CommandWhat it does
docker run -d -p 8080:80 nginxStarts a container from the nginx image and maps it to port 8080
docker psLists running containers (-a for all)
docker imagesLists images on your machine
docker pull postgres:17Downloads an image
docker build -t myapp .Builds an image from the Dockerfile in the current folder
docker logs -f <container>Follows container logs live
docker exec -it <container> shOpens a shell inside a running container
docker stop <container> / docker rm <container>Stops / removes a container
docker compose up -dStarts all services in docker-compose.yml

A Simple Dockerfile Example

An example Dockerfile that packages a Node.js app:

FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]

To build and run the image:

docker build -t myapp .
docker run -d -p 3000:3000 --name myapp myapp

App + Database with Docker Compose

Real projects usually have more than one service. With docker-compose.yml you can define the app and the database together and bring them up with a single command (docker compose up -d):

services:
  web:
    build: .
    ports:
      - "3000:3000"
    depends_on:
      - db
  db:
    image: postgres:17
    environment:
      POSTGRES_PASSWORD: example-password
    volumes:
      - db-data:/var/lib/postgresql/data

volumes:
  db-data:

Always change the example password in real projects and keep it in a .env file.

Docker and Kubernetes

Docker is great for running containers on a single server. But when you need to scale dozens of containers across multiple servers automatically, restart the ones that crash and update without downtime, Kubernetes steps in. In short, you build your image with Docker and manage those images at scale with Kubernetes. See our What is Kubernetes post for details; if you want to try it on a ready cluster, we have Kubernetes Server packages.

Running Docker on a Server

To ship the app you built on your laptop, you need a server with Docker installed. VECDC Developer VDS packages are delivered with Docker installed; they start at $6/month and are ready in about 5 minutes thanks to automated setup. Just connect and run docker compose up -d. If you'd rather install Docker yourself, the Linux steps above work exactly the same on our standard virtual servers. To automate your build and deploy process, check out our CI/CD consulting service.

Common Problems

Error / symptomCauseFix
permission denied ... docker.sock (Linux)Your user isn't in the docker groupsudo usermod -aG docker $USER, then sign out and back in
Docker Desktop won't start, WSL error (Windows)Virtualization is off or WSL is outdatedEnable virtualization in BIOS, run wsl --update
port is already allocatedThe port is used by another app or containerUse a different port (e.g. -p 8081:80) or stop the other one
Disk fills up fastOld images, containers and build cache piled updocker system prune (use with care)
Cannot connect to the Docker daemonThe Docker service / Docker Desktop isn't runningOn Linux sudo systemctl start docker, on Windows/Mac open Docker Desktop

Frequently Asked Questions

Is Docker free?

Docker Engine, used on Linux, is open source and free. Docker Desktop on Windows and macOS is free for personal use, education and small businesses, but requires a paid subscription for companies above a certain size.

What's the difference between Docker and a virtual machine?

A virtual machine emulates a full computer with its own operating system; a container shares the host's kernel and isolates just the application. That's why containers are much smaller, start in seconds and use fewer resources.

Do I need Docker Desktop on Windows?

Docker Desktop is the easiest and most common way on Windows. Advanced users can install Docker Engine directly inside a Linux distribution running in WSL 2, but that takes more manual setup.

Is Docker hard to learn?

For basic use you only need a few concepts (image, container, Dockerfile, volume) and a handful of commands; most people can containerize their own app within a day or two. Networking, security and production details come with time.

In Short

Docker lets you package apps with their dependencies and run them the same way everywhere. On Linux you install Docker Engine directly, and on Windows and macOS Docker Desktop gets you up and running in a few minutes. Once you get used to it, your development and deployment process becomes alot simpler. If you get stuck during the install, drop us a message, were happy to help.

Your Virtual Server, Ready in 5 Minutes

NVMe virtual servers with dedicated resources start at $6/month.

See Packages →