Installation & Verification

[!WARNING] We will not cover platform-specific installation steps (apt, yum, brew) in detail as they change frequently. Refer to the Official Docs. Instead, we focus on verification and post-install configuration.

1. The Critical Post-Install Step (Linux)

By default, the Docker daemon binds to a Unix socket owned by the root user. If you run docker ps as a regular user, you will get:

permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

Why?

The docker command talks to the daemon via a file called /var/run/docker.sock. This file has strict permissions:

ls -l /var/run/docker.sock
# srw-rw---- 1 root docker 0 Feb 19 10:00 /var/run/docker.sock

Only root and members of the docker group can write to it.

The Fix

Add your user to the docker group to avoid typing sudo every time.

sudo usermod -aG docker $USER
newgrp docker

[!CAUTION] Security Implication: Adding a user to the docker group is equivalent to giving them root access. A user can run docker run -v /:/host alpine and modify any file on the host system as root.


2. Verifying the Installation

Don’t just assume it works. Run these commands to verify the entire stack.

Step 1: Check Client & Server Version

Ensures both the CLI and Daemon are running and talking to each other.

docker version

If you only see “Client” output and an error for “Server”, your daemon is not running.

Step 2: Run the Hello World

This tests: Internet connectivity (pull), Image storage, Container creation, and Logging.

docker run hello-world

3. Interactive Troubleshooter

Having issues? Use this interactive guide to diagnose common problems.

Docker Diagnostic Tool

What error are you seeing?