KOSUNI KOREA
Korean News in English
Technology

How to Install Docker on Linux: Distribution-Specific Steps Explained

Published October 15, 2026 · 2 views
How to Install Docker on Linux: Distribution-Specific Steps Explained

리눅스에 Docker 설치 리눅스 배포판별 절차 정리

When installing Docker on Linux, the commands vary slightly by distribution, but the core process remains the same. The main steps involve adding the correct repository, installing Docker Engine, and verifying that the service starts properly. Ubuntu commonly uses the official repository method, while RHEL-based distributions like CentOS rely on configuring dnf or yum.

Newcomers often struggle most with determining "the right installation method for my Linux version" and "how to set up permissions after installation." Following these steps will help you avoid major confusion during Docker setup.

Installation Method Differences by Distribution

Docker appears as a consistent program across all Linux distributions, but the installation path differs based on your distribution. Ubuntu and Debian-based systems use APT repositories, while RHEL, CentOS, Rocky, and AlmaLinux use DNF or YUM.

First, it's important to confirm your distribution and version. You can check this in the terminal by running cat /etc/os-release. For example, if you're using Ubuntu 22.04, adding Docker's official repository is typically the safest approach.

Using only the default distribution repositories may result in outdated Docker versions. In production environments, stability often matters more than having the latest features, so consider whether you truly need the newest version before proceeding.

Read More Related Articles

You can find a collection of similar articles on this topic.

View Related Articles

Installing Docker on Ubuntu

On Ubuntu, the most common method is adding the official repository. First, update your package list and install necessary tools:

sudo apt update
sudo apt install -y ca-certificates curl gnupg

Next, register Docker's GPG key and repository. Skipping this step may cause signature verification errors during package installation. Then, install docker-ce, docker-ce-cli, and containerd.io.

After installation, enable the service to start automatically with sudo systemctl enable --now docker. Finally, verify proper operation by running sudo docker run hello-world. If this command succeeds, your basic installation is complete.

A common issue is permission problems. To avoid typing sudo every time, add your user to the docker group using sudo usermod -aG docker $USER, then log out and back in for changes to take effect.

Installing Docker on CentOS-Based Systems

CentOS, Rocky, and AlmaLinux systems follow a similar flow, with differences only in the package manager. First, remove any outdated Docker packages, add the repository, and install the engine.

Most installations begin with dnf install -y dnf-plugins-core, followed by registering the Docker repository. Then install docker-ce, docker-ce-cli, and containerd.io, and start the service with systemctl enable --now docker.

In real-world scenarios, firewall or SELinux settings may prevent container ports from opening immediately. In such cases, check network policies and security configurations alongside Docker installation. If installation appears correct but you can't connect, these are usually the first things to investigate.

리눅스에 Docker 설치 리눅스 배포판별 절차 정리

Essential Commands After Installation

Installation isn't complete until you verify that Docker is running properly, the version is correct, and containers can be created.

First check the version with docker --version, then confirm service status using sudo systemctl status docker. Next, run sudo docker images or sudo docker ps to ensure basic commands work as expected.

The simplest test remains the hello-world container. Since it downloads and runs a small image, this checks both network connectivity and engine functionality simultaneously. Passing this initial test is usually sufficient to confirm your installation path was correct.

For example, if firewall settings block access or DNS issues exist, image downloads may fail even though Docker service is running. Thus, verification should include actual execution, not just version checking.

Common Installation Errors

The most frequent Docker installation errors involve incorrect repository addresses or missing GPG keys. If your distribution version doesn't match, you might see "package not found" messages.

Another common issue is conflicts with older package versions. Previous installations of docker or docker.io may cause installation conflicts; removing these first before proceeding often resolves the problem.

Permission errors also frequently occur. If you see "docker: permission denied," your account likely isn't in the docker group. Adding to the group requires logging out and back in for changes to apply.

In environments with proxy servers (common on corporate servers), issues typically arise during image downloads rather than installation itself. In such cases, verify proxy settings and DNS configuration alongside installation commands.

Common Real-World Installation Examples

For development-focused Ubuntu servers, the typical flow involves updating packages, adding repositories, installing Docker, enabling the service, and running a test.

For example, on Ubuntu 22.04, after installation you can run docker run -d -p 8080:80 nginx to launch an Nginx web server container. You can then verify operation by accessing port 8080 on your server's IP address through a browser.

In production environments, administrators often configure network policies before exposing ports. Setting up volume mounts, restart policies, and log monitoring upfront makes troubleshooting future issues significantly easier.

I personally recommend checking docker info immediately after installation. This command reveals storage drivers, cgroup settings, root directory information, and other useful environment details for system understanding.

Recommended Post-Installation Settings

After installing Docker, consider making some basic configuration adjustments to improve usability. The first thing to check is automatic startup behavior, followed by whether regular accounts can use Docker without sudo.

If your server restarts frequently, systemctl enable docker is essential. For developers who regularly work with containers, adding users to the docker group simplifies workflow significantly. With both configured properly, you won't need to prefix commands with sudo.

On servers with limited storage space, images and containers can quickly fill disk space. Regularly checking usage with docker system df and developing habits for cleaning unused images helps maintain optimal performance.

FAQ

Q. What should I check if hello-world doesn't run after Docker installation?
First verify Docker service status and network connectivity. Then systematically check repository configuration, DNS settings, and proxy configuration to narrow down the cause.

Q. How can I use Docker without sudo?
Add your user to the docker group using sudo usermod -aG docker $USER, then log out and back in for changes to take effect.

Q. Is it okay to install from the default distribution repository?
You can, but versions may be outdated or packages might differ. For stable production environments or when needing newer features, using the official repository is generally recommended.

Finally, note that distribution versions and repository policies change over time. Always verify current instructions before proceeding with installation for your specific environment.

Note: Commands and package names may vary by distribution and version. Always confirm the correct procedure for your current Linux environment before installing.
View More in This Category

Continue exploring similar topics.

View Category Articles

FAQ

What should I check if hello-world doesn't run after Docker installation?

First verify Docker service status and network connectivity. Then systematically check repository configuration, DNS settings, and proxy configuration to narrow down the cause.

How can I use Docker without sudo?

Add your user to the docker group using `sudo usermod -aG docker $USER`, then log out and back in for changes to take effect.

Is it okay to install from the default distribution repository?

You can, but versions may be outdated or packages might differ. For stable production environments or when needing newer features, using the official repository is generally recommended.

Korean Source

This article is an English localization of a Korean-language report from BlogScore. Original: 리눅스에 Docker 설치 리눅스 배포판별 절차 정리