From installation to production. Copy-paste commands for every step.
Last updated: April 2026
Run this in your terminal. If you see a version number, Docker is installed.
docker --versionOfficial one-liner from get.docker.com. Works on Ubuntu, Debian, CentOS, Fedora.
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.shAfter install, add your user to the docker group to run without sudo:
sudo usermod -aG docker $USER && newgrp dockerInstall Docker Desktop — it includes Docker Engine, Docker Compose, and a GUI.
Pull and run the hello-world image to verify Docker works.
docker run hello-worldRun an interactive Ubuntu container:
docker run -it ubuntu bashImages are read-only templates for containers. Pull from Docker Hub:
docker pull nginx:alpinedocker imagesdocker rmi nginx:alpineA Dockerfile defines how to build your image. Create a file named Dockerfile:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]Build and tag the image:
docker build -t my-app:latest .Volumes persist data beyond container lifecycle.
docker volume create my-datadocker run -v my-data:/app/data nginxdocker run -v $(pwd)/src:/app/src nginxContainers communicate through Docker networks.
docker network create my-netdocker run --network my-net --name web nginxdocker network lsdocker psdocker ps -adocker logs -f <container>docker exec -it <container> shdocker stop <container>docker rm <container>docker system prune -afDockerBot
AI-powered assistant