Module 2 Lesson 2: Installing Docker
·DevOps

Module 2 Lesson 2: Installing Docker

Get your environment ready. Step-by-step instructions for installing Docker Desktop on Windows and Mac, and Docker Engine on Linux.

Module 2 Lesson 2: Installing Docker

Before we can run containers, we need the engine. This lesson covers the installation path for the three major operating systems.

1. Windows: Docker Desktop

Docker Desktop is the recommended way to run Docker on Windows. It uses WSL 2 (Windows Subsystem for Linux) for the best performance.

  • Prerequisites: Windows 10/11 (Pro, Enterprise, or Home) with WSL 2 enabled.
  • Steps:
    1. Download the "Docker Desktop for Windows" installer from docker.com.
    2. Run the installer. Ensure the "Use WSL 2 instead of Hyper-V" option is checked.
    3. Restart your computer.
    4. Open the Docker Desktop app. Wait for the whale icon in the taskbar to stay still.

2. Mac: Docker Desktop

Docker Desktop for Mac provides a seamless experience for both Intel and Apple Silicon (M1/M2/M3) chips.

  • Prerequisites: macOS version 11 or newer.
  • Steps:
    1. Download the correct installer (Intel vs. Apple Chip) from docker.com.
    2. Double-click the .dmg and drag the Docker icon to your Applications folder.
    3. Launch Docker from your Applications.
    4. Grant the necessary permissions for networking and privileged access.

3. Linux (Ubuntu Example)

On Linux, we usually install the Docker Engine (no GUI) directly.

  • Steps:
    1. Update your packages: sudo apt-get update.
    2. Install prerequisites: sudo apt-get install ca-certificates curl gnupg.
    3. Add Docker’s official GPG key and repository.
    4. Install the engine: sudo apt-get install docker-ce docker-ce-cli containerd.io.
  • Post-Install (Crucial): By default, you have to run sudo docker. To run without sudo, add your user to the docker group:
    sudo usermod -aG docker $USER
    
    (Log out and log back in for this to take effect).

4. Verifying the Installation

Open your terminal (Command Prompt, PowerShell, or Terminal) and run:

docker --version

Then, try the most famous first command:

docker run hello-world

If you see: "Hello from Docker! This message shows that your installation appears to be working correctly," you are ready!


Troubleshooting Common Issues

  • "Docker daemon not running": On Windows/Mac, make sure the Docker Desktop app is actually open.
  • "WSL 2 installation is incomplete": Follow the link provided in the Docker error message to update the Linux kernel component from Microsoft.
  • "Permission Denied": On Linux, make sure you performed the usermod step above.

Exercise: System Check

  1. Run docker info in your terminal. Look for the "Operating System" and "Kernel Version" entries. What do they say?
  2. If you are on Windows/Mac, check the Docker Desktop settings. How many CPUs and how much RAM is Docker allowed to use by default?
  3. Why is it better to use WSL 2 on Windows instead of the older "Hyper-V" backend? (Search for "Docker WSL2 benefits").

Summary

You now have a working Docker environment. Whether you chose the GUI-friendly Desktop version or the raw Linux Engine, the core commands we learn next will work exactly the same way.

Next Lesson: We master the command line: Core Docker CLI commands.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn