Getting Started with Docker: Concepts and Installation

Intro to Docker and how to install it on Ubuntu.


Docker has become a cornerstone in modern software development, making it easier for developers and operations teams to build, ship, and run applications anywhere, without worrying about dependencies or inconsistencies. If you're new to Docker, this guide will introduce you to its core concepts and walk you through installing Docker on Ubuntu.

What Is Docker?

Docker is a platform that uses operating system virtualization to deliver software in packages called containers. Containers are lightweight, standalone, and executable packages that contain everything needed to run an application—code, runtime, libraries, and settings.

Why Use Docker?

  • Consistency: Containers encapsulate everything an app needs, so they run consistently across environments.
  • Isolation: Each container runs in its isolated environment, avoiding conflicts.
  • Portability: Containers can be moved between different machines seamlessly.
  • Efficiency: Containers are more lightweight than traditional virtual machines.

Core Docker Concepts

Before jumping into the installation, let's review key terms:

1. Image

An image is a read-only template containing the instructions for creating a container. For example, an Ubuntu-based image with Node.js installed.

2. Container

A container is an instance of an image. It represents a runnable process that is isolated from the host system.

3. Dockerfile

A text file that has instructions to build a Docker image. Think of it as a recipe.

4. Docker Hub

A public registry where you can find and share Docker images.

5. Volumes

Persistent storage mechanism for containers.


Prerequisites

  • A system running Ubuntu (20.04 LTS or newer recommended)
  • A user account with sudo privileges
  • Internet access

Installing Docker on Ubuntu

Follow these steps to install Docker from the official Docker repository on Ubuntu.

1. Update Your System

sudo apt update
sudo apt upgrade

2. Install Required Packages

Install packages to allow apt to use repositories over HTTPS.

sudo apt install apt-transport-https ca-certificates curl software-properties-common

3. 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

4. Add the Docker APT 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

5. Update the Package Database

sudo apt update

You should see Docker packages coming from download.docker.com.

6. Install Docker Engine

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

7. Verify Docker Installation

After installation, start the Docker service and check its status:

sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker

Test Docker with:

sudo docker run hello-world

If you see a "Hello from Docker!" message, installation was successful!


Optional: Manage Docker as a Non-root User

To avoid typing sudo with docker commands, add your user to the docker group:

sudo usermod -aG docker $USER

Log out and log back in, or reboot for this to take effect.


What’s Next?

Now that Docker is installed, you can:

  • Pull and run images from Docker Hub.
  • Create your own images using Dockerfiles.
  • Explore docker-compose for managing multi-container applications.

Stay tuned for more tutorials on using Docker to streamline development, testing, and deployment!


References:


Happy containerizing!