Docker Quickstart

docker/docker-ce

B+ Clarity
7 Steps
12 min Time
macOS, Linux, Windows Tested On
100% Copy-Paste Ready
0 Issues

Get Docker running on your machine and deploy your first container in under 12 minutes. This guide covers installation, verification, and running your first containerized application.

Prerequisites

  • 💻
    Operating System macOS 12+, Ubuntu 20.04+, or Windows 10/11 with WSL2
  • 💾
    Disk Space At least 4GB free
  • 🔑
    Admin Access sudo/administrator privileges required

Install Docker

1

Install Docker

~5 min

Download and install Docker Desktop for your platform:

macOS (using Homebrew):

bash
brew install --cask docker

💡 After installation, open Docker Desktop from Applications to complete setup.

Linux (Ubuntu/Debian):

bash
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up the repository

echo “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io

Windows:

powershell
winget install Docker.DockerDesktop

⚠️ WSL2 must be installed. Run wsl --install first if needed.

Verify Installation

2

Verify Installation

~1 min

Check that Docker is installed correctly:

bash
docker --version
Expected output:
Docker version 24.0.7, build afdd53b

Run Hello World

3

Run Hello World

~1 min

Test Docker by running the official hello-world image:

bash
docker run hello-world
Expected output:
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
🎉
Docker is working!

You've successfully pulled and run your first container.

Run an Interactive Container

4

Run an Interactive Container

~2 min

Start an Ubuntu container and get a shell inside it:

bash
docker run -it ubuntu bash

You’re now inside the container. Try running some commands:

bash
# Inside the container
cat /etc/os-release
exit

💡 The -it flags give you an interactive terminal. Type exit to leave.

Run a Web Server

5

Run a Web Server

~2 min

Start an Nginx web server that you can access from your browser:

bash
docker run -d -p 8080:80 --name my-nginx nginx

Open your browser and visit:

🌐 http://localhost:8080

📝 -d runs in background, -p 8080:80 maps port 8080 on your machine to port 80 in the container.

Manage Containers

6

Manage Containers

~1 min

View running containers:

bash
docker ps
Expected output:
CONTAINER ID   IMAGE   COMMAND                  STATUS         PORTS                  NAMES
a1b2c3d4e5f6   nginx   "/docker-entrypoint.…"   Up 2 minutes   0.0.0.0:8080->80/tcp   my-nginx

Stop and remove the container:

bash
docker stop my-nginx
docker rm my-nginx

Create Your Own Image

7

Create Your Own Image

~2 min

Create a simple Dockerfile:

dockerfile
# Save this as Dockerfile
FROM nginx:alpine
COPY index.html /usr/share/nginx/html/
EXPOSE 80

Create a simple HTML file:

html
<!DOCTYPE html>
<html>
<head><title>My Docker App</title></head>
<body><h1>Hello from Docker! 🐳</h1></body>
</html>

Build and run your image:

bash
docker build -t my-app .
docker run -d -p 8080:80 my-app
🚀
You've built your first Docker image!

Visit localhost:8080 to see your custom app running.

Next Steps