Back to Blog
Lesson 2 of the Docker: Containers & Your First Image course
DevOpsJuly 13, 20264 min read

Setting Up the Docker Engine: A Beginner’s Installation Guide

Master the Docker Engine installation process. Learn how to set up your environment, verify the daemon status, and use the CLI to prepare for containerization.

dockerinstallationdevopscontainersclisetup

Previously in this course, we explored the conceptual differences between virtual machines and containers in Virtual Machines vs Containers. Now that you understand the role of the container engine, it’s time to get your hands dirty by performing the actual installation and setup of the Docker Engine on your local machine.

Why the Docker Engine Matters

The Docker Engine is the core software that enables you to create and run containers. It acts as a client-server application consisting of a daemon (the background service that manages containers) and a command-line interface (CLI) that allows you to interact with that daemon. Whether you are setting up the local development environment for PHP or preparing for a cloud-native project, having a consistent Docker installation is your first step toward reproducible infrastructure.

Choosing Your Installation Path

You have two primary ways to install Docker, depending on your operating system:

  1. Docker Desktop: The recommended approach for macOS, Windows, and many Linux users. It provides a GUI for managing images and containers, built-in Kubernetes support, and a pre-configured Docker Engine.
  2. Docker Engine (Server/CLI): Often preferred on Linux servers where a GUI is unnecessary. You install the docker-ce (Community Edition) package directly via your distribution’s package manager.

Regardless of your choice, the result is the same: a functional docker command in your terminal and a background process (the daemon) ready to handle your instructions.

Verifying Your Setup

Once the installation completes, the most important step is verifying that both the CLI and the daemon are communicating correctly. Open your terminal or command prompt and run the following command:

Bash
docker version

If the installation was successful, you will see output detailing the version of both the Client and the Server (the daemon). If the "Server" section is missing or shows an error, it means the Docker daemon is not running.

Checking Daemon Status

On Linux, you can check the daemon status using systemctl:

Bash
sudo systemctl status docker

If it says active (running), you are ready to go. On macOS or Windows, if you have Docker Desktop installed, ensure the application is open; the whale icon in your system tray indicates the engine is active.

Hands-on Exercise: Confirming Your Environment

To ensure your setup is fully functional, perform these three steps:

  1. Install: Download and install Docker Desktop for your OS.
  2. Verify CLI: Run docker version and note the versions listed.
  3. Verify Daemon: Run docker info in your terminal. This command provides a deep dive into your system configuration, including the number of containers, images, and the storage driver being used. If this command returns a detailed summary without errors, your Docker Engine is correctly configured.

Common Pitfalls

  • Permission Denied (Linux): If you are on Linux and see "permission denied" when running docker commands, you likely need to add your user to the docker group. Run sudo usermod -aG docker $USER and log out/in to apply the changes.
  • Daemon Not Running: If docker version shows an error connecting to the daemon, your Docker service may have failed to start on boot. Always check your system tray or systemctl to ensure the process is alive.
  • Virtualization Disabled: On Windows and macOS, ensure that hardware virtualization is enabled in your BIOS/UEFI settings if you experience issues launching the engine.

FAQ

Q: Do I need to pay for Docker? A: Docker Desktop is free for individuals, educational use, and small businesses. Large enterprises may require a paid subscription. The open-source Docker Engine remains free for everyone.

Q: Can I run Docker without a GUI? A: Yes. On Linux, you can install the Docker Engine via the command line without the Docker Desktop GUI, which is standard practice for production servers.

Recap

In this lesson, we moved from theory to practice by installing the Docker Engine and confirming that the CLI can communicate with the daemon. You are now equipped with a local environment capable of managing containers. This foundational setup is the prerequisite for all the work we will do in this course as we build our multi-service application.

Up next: We will run our first container image and explore the container lifecycle in "Running Hello World."

Similar Posts