How to Install Docker on RHEL and Ubuntu

Prev Next

WHAT TO EXPECT

In this section, users will learn how to install Docker Engine for either RHEL or Ubuntu. For a more detailed instructions, see their respective pages on the Docker documentation site:

PLEASE NOTE

For virtual machines it is NOT recommended to install Docker Desktop. Use Docker Engine instead.

For bare metal machines that will run swxtch.io software it is still recommended to use Docker Engine, unless there is a full desktop environment with a display server like X11 or Wayland.

PLEASE NOTE

There are two ways to get Docker. The official (Docker-CE or Community Edition), maintained and hosted by Docker Inc. and Docker.io, maintained and distributed by the OS (RHEL, Ubuntu, etc).

swxtch.io software works with both. But when installing our software using the --auto_deps argument will automatically download docker.io.

If docker-ce is needed, then the user must install first that Docker manually, and then install our software.

Installing Docker-ce on RHEL

  1. Run the following command to prepare the repositories for the Docker install:

    sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
    cat /etc/yum.repos.d/docker-ce.repo
    sudo sed -i 's/$releasever/9/g' /etc/yum.repos.d/docker-ce.repo
    cat /etc/yum.repos.d/docker-ce.repo
    sudo dnf -y install dnf-plugins-core
  2. Install Docker-ce:

    sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  3. Continue on to Enabling Docker.

Installing Docker-ce on Ubuntu

  1. Install Docker:

    curl https://get.docker.com/ > dockerinstall && chmod 777 dockerinstall && sudo ./dockerinstall
  2. Continue on to Enabling Docker.

Enabling Docker

After installing Docker-ce, run the following commands to enable it on your machine:

sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo systemctl start docker