Skip to content

Instantly share code, notes, and snippets.

@lw-thomaswood
Last active November 9, 2020 17:11
Show Gist options
  • Save lw-thomaswood/47c2308e485129af1be9a2664064e17f to your computer and use it in GitHub Desktop.
Save lw-thomaswood/47c2308e485129af1be9a2664064e17f to your computer and use it in GitHub Desktop.
Docker in RHEL/CentOS 8
Assistance from this article: https://www.liquidweb.com/kb/how-to-install-docker-on-centos-8/
=============================
Introduction
=============================
Red Hat and Docker broke up which means you can't just install Docker in CentOS or RHEL 8 and expect it to work.
In fact if you follow the docker instructions to install, you *will* get some of docker installed but when you try to start the service it will bomb.
So how do we get around this? Trick yum (or dfn) into thinking we're running release 7. Then install Docker and Docker Compose.
=============================
Procedure
=============================
Add Docker repo
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Edit docker-ce.repo to change version
vi /etc/yum.repos.d/docker-ce.repo
Search for the "Docker CE Stable" block and change the baseurl value
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/
Confirm you have packages for version 7
dnf list docker-ce
Install Docker with last good package
dnf install docker-ce --nobest
Confirm Docker installed
docker -v
Launch Docker
systemctl enable --now docker
Confirm install
systemctl status docker
Add user(s) to docker group
usermod -aG docker root
Confirm your user is in the correct group
id root
Test Docker (note: you may need to logout for your user's group assignment to take effect)
docker run hello-world
=============================
Addendum 01: FirewallD (the D stands for "Die, Docker, Die!"
=============================
While I haven't run into this issue using RHEL8 AMI in AWS, many users report that RHEL/CentOS 8 firewall blocks traffic within the cluster (specifically DNS lookups).
Disable the system firewall to cleanup that behavior
systemctl disable firewalld
=============================
Addendum 02: Docker Compose
=============================
So you want docker-compose to work? Get ready to install it manually.
curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Make your newest toy executable
chmod +x /usr/local/bin/docker-compose
Floss your new whip
docker-compose -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment