Skip to content

Instantly share code, notes, and snippets.

@dparnell
Created January 12, 2023 03:49
Show Gist options
  • Save dparnell/c7dea31ecdec863e82545c285ff0cb5a to your computer and use it in GitHub Desktop.
Save dparnell/c7dea31ecdec863e82545c285ff0cb5a to your computer and use it in GitHub Desktop.
Install docker on Oracle Linux 7.9
#!/bin/bash
# Tested on Oracle Linux 7.9, 11th, Jan 2023
if [ "${UID}" -eq 0 ]
then
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sed -i 's/$releasever/7/g' /etc/yum.repos.d/docker-ce.repo
mkdir rpms && cd rpms
yum install policycoreutils-python libseccomp wget -y
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/slirp4netns-0.4.3-4.el7_8.x86_64.rpm
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/fuse3-libs-3.6.1-4.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.119.1-1.c57a6f9.el7.noarch.rpm
rpm -Uvh container-selinux-2.119.1-1.c57a6f9.el7.noarch.rpm
rpm -Uvh slirp4netns-0.4.3-4.el7_8.x86_64.rpm fuse3-libs-3.6.1-4.el7.x86_64.rpm fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
yum install docker-ce docker-ce-cli containerd.io -y
cd .. && rm -rf rpms
systemctl enable docker
systemctl start docker
docker run --rm hello-world
else
echo This script must be run as root
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment