|
| 1 | +# Docker on CloudLinux |
| 2 | + |
| 3 | +[[toc]] |
| 4 | + |
| 5 | +## Introduction |
| 6 | + |
| 7 | +A common question is: **Can Docker be installed with CloudLinux?** |
| 8 | + |
| 9 | +**Docker can run inside CloudLinux**, but CloudLinux cannot run inside Docker. |
| 10 | + |
| 11 | +Docker Engine and local containers are supported on **CloudLinux OS 8+**. |
| 12 | + |
| 13 | +:::warning CloudLinux OS 7 |
| 14 | +Docker's official RHEL repository no longer publishes packages for RHEL 7 (`https://download.docker.com/linux/rhel/7/x86_64/stable/` unavailable), so neither method below works on CL7 as-is. |
| 15 | +Two legacy paths still exist - see [CloudLinux OS 7 (legacy)](#cloudlinux-os-7-legacy) below. It's recommended to upgrade to a newer CloudLinux OS version via [ELevate](/cloudlinuxos/elevate/). |
| 16 | +::: |
| 17 | + |
| 18 | +There are two installation options: |
| 19 | + |
| 20 | +* **Direct installation** - add Docker's RHEL repo and install with `dnf`; no system changes required. |
| 21 | +* **Docker convenience script** - served from [get.docker.com](https://get.docker.com); requires a one-time `os-release` workaround. |
| 22 | + |
| 23 | +This guide describes both. |
| 24 | + |
| 25 | +Note that Docker is **not** in default CloudLinux repos; both methods use Docker's [official RHEL repo](https://docs.docker.com/engine/install/rhel/). |
| 26 | + |
| 27 | +## Method 1: Direct installation (repo + dnf) |
| 28 | + |
| 29 | +Add Docker's RHEL repository and install packages with `dnf`. No change to `/etc/os-release` or any other system file is required. |
| 30 | + |
| 31 | +**Steps:** |
| 32 | + |
| 33 | +```bash |
| 34 | +# Add Docker repo (RHEL) |
| 35 | +sudo dnf -y install dnf-plugins-core |
| 36 | +sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo |
| 37 | + |
| 38 | +# Install and start |
| 39 | +sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
| 40 | +sudo systemctl enable --now docker |
| 41 | + |
| 42 | +# Verify |
| 43 | +sudo docker run --rm hello-world |
| 44 | +``` |
| 45 | + |
| 46 | +:::tip Notes |
| 47 | +* No workaround needed; leave `ID=cloudlinux` in `/etc/os-release` as-is. |
| 48 | +* You control exactly which packages and repo are added. |
| 49 | +::: |
| 50 | + |
| 51 | +## Method 2: Docker convenience script (get.docker.com) |
| 52 | + |
| 53 | +Use the official [Docker convenience script](https://get.docker.com) (e.g. `curl -fsSL https://get.docker.com | sh`). The script detects the OS via `ID` in `/etc/os-release` and only supports a fixed list of distributions. |
| 54 | + |
| 55 | +CloudLinux is not in that list, so with the default `ID=cloudlinux` the script exits with: |
| 56 | + |
| 57 | +```text |
| 58 | +ERROR: Unsupported distribution 'cloudlinux' |
| 59 | +``` |
| 60 | + |
| 61 | +On CloudLinux OS 10, with `ID=almalinux`, the same applies, since `almalinux` is not supported by the script either. |
| 62 | + |
| 63 | +**Workaround:** Temporarily set `ID=centos` in `/etc/os-release` so the script uses the RHEL/CentOS path and adds the Docker CE repo. Revert `ID` after installation. |
| 64 | + |
| 65 | +**Steps:** |
| 66 | + |
| 67 | +1. **Apply the workaround** (one-time, before running the script). Edit `/etc/os-release` and change: |
| 68 | + |
| 69 | +* CloudLinux OS 8 / CloudLinux OS 9: `ID=cloudlinux` -> `ID=centos` |
| 70 | +* CloudLinux OS 10: `ID=almalinux` -> `ID=centos` |
| 71 | + |
| 72 | +2. **Run the script:** |
| 73 | + |
| 74 | +```bash |
| 75 | +curl -fsSL https://get.docker.com | sh |
| 76 | +``` |
| 77 | + |
| 78 | +3. **Start Docker** (if the script didn't): |
| 79 | + |
| 80 | +```bash |
| 81 | +sudo systemctl enable --now docker |
| 82 | +``` |
| 83 | + |
| 84 | +4. **Verify:** |
| 85 | + |
| 86 | +```bash |
| 87 | +sudo docker run --rm hello-world |
| 88 | +``` |
| 89 | + |
| 90 | +:::tip Notes |
| 91 | +* The script has **no option or environment variable** to override or ignore the OS check (only `--version`, `--channel`, `--mirror`, etc.). Without modifying the script, the workaround above is the way to use it on CloudLinux. |
| 92 | +::: |
| 93 | + |
| 94 | +## CloudLinux OS 7 (legacy) |
| 95 | + |
| 96 | +Docker no longer publishes el7 RPMs to its main RHEL repository, but two archive paths remain on `download.docker.com`. |
| 97 | + |
| 98 | +### Option A: Frozen CentOS 7 RPM archive |
| 99 | + |
| 100 | +The CentOS 7 path on `download.docker.com` is served but frozen. |
| 101 | + |
| 102 | +It will not receive future security updates from Docker - use at your own risk. |
| 103 | + |
| 104 | +* Repo file: [`https://download.docker.com/linux/centos/docker-ce.repo`](https://download.docker.com/linux/centos/docker-ce.repo) |
| 105 | +* Package index: [`https://download.docker.com/linux/centos/7/x86_64/stable/Packages/`](https://download.docker.com/linux/centos/7/x86_64/stable/Packages/) |
| 106 | + |
| 107 | +Installation follows the same shape as [Method 1](#method-1-direct-installation-repo-dnf), but with `yum` instead of `dnf` and the CentOS repo file instead of the RHEL one: |
| 108 | + |
| 109 | +```bash |
| 110 | +sudo yum -y install yum-utils |
| 111 | +sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo |
| 112 | +sudo yum install -y docker-ce docker-ce-cli containerd.io |
| 113 | +sudo systemctl enable --now docker |
| 114 | +``` |
| 115 | + |
| 116 | +### Option B: Docker static binaries |
| 117 | + |
| 118 | +Docker publishes OS-independent static binaries that run on any modern x86_64 Linux kernel (including CloudLinux OS 7's LVE kernel). |
| 119 | + |
| 120 | +* Download index: [`https://download.docker.com/linux/static/stable/x86_64/`](https://download.docker.com/linux/static/stable/x86_64/) |
| 121 | +* Updated alongside main Docker releases |
| 122 | +* Ships `dockerd` and `docker` as standalone binaries - no systemd unit, package-manager integration, or automatic security updates |
| 123 | + |
| 124 | +You will need to write your own systemd unit, manage users/groups, and track upstream releases manually. |
| 125 | + |
| 126 | +See Docker's official [Install Docker Engine from binaries](https://docs.docker.com/engine/install/binaries/) for the procedure. |
0 commit comments