Skip to content

Instantly share code, notes, and snippets.

@ryanmaclean
Created July 13, 2021 00:18
Show Gist options
  • Save ryanmaclean/91b270d858939729443f889760b4d72f to your computer and use it in GitHub Desktop.
Save ryanmaclean/91b270d858939729443f889760b4d72f to your computer and use it in GitHub Desktop.
Install Docker on Rocky Linux
#!/usr/bin/env bash
## Script to install docker-ce on Rocky Linux
## Run using `sudo rocky-docker.sh`
# Ensuring "GROUP" variable has not been set elsewhere
unset GROUP
echo "Removing podman and installing Docker CE"
dnf remove -y podman buildah
dnf install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf install -y docker-ce docker-ce-cli containerd.io
echo "Setting up docker service"
systemctl enable docker
systemctl start docker
systemctl status docker
echo "Adding permissions to current user for docker, attempting to reload group membership"
usermod -aG docker -a $USER
GROUP=$(id -g)
newgrp docker
newgrp $GROUP
unset GROUP
echo "Install completed, though you will probably require logout/login if the following command fails:"
docker ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment