Created
December 1, 2021 15:27
-
-
Save abuxton/6122c5c68823d108e3b2e9bfd36d8816 to your computer and use it in GitHub Desktop.
rhel7-docker-install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash +X | |
# later we will disable selinux | |
# sudo setenforce Permissive | |
# getenforce # just incase youy want to check selinuxmode | |
# lets make sure we are a clean install of docker | |
sudo yum remove docker docker-common docker-selinux docker-engine-selinux docker-engine docker-ce | |
# now install some tools dmpd(for short) ensures rhel 7 respects gpg settings in repos (issue is https://access.redhat.com/solutions/2850911) see https://access.redhat.com/discussions/5336741 for the fix | |
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 | |
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
## ok now we have some unmet dependacies and it gets a little hacky (note these are not available in https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/) | |
# source from centos/os repo | |
sudo cat > /etc/yum.repos.d/centos-os.repo << EOF | |
[centos-os] | |
name=Centos os - $basearch | |
baseurl=http://mirror.centos.org/centos/7/os/x86_64/ | |
enabled=1 | |
gpgcheck=0 | |
EOF | |
sudo yum install libcgroup-tools | |
# ok lets get the rest of teh dependacies https://stackoverflow.com/a/66902898/2362673 | |
sudo cat > /etc/yum.repos.d/centos-extras.repo << EOF | |
[centos-extras] | |
name=Centos extras - $basearch | |
baseurl=http://mirror.centos.org/centos/7/extras/x86_64 | |
enabled=1 | |
gpgcheck=0 | |
EOF | |
sudo yum -y install slirp4netns fuse-overlayfs container-selinux | |
# finally lets install docker | |
sudo yum install -y docker-ce-20.10.7-3.el7 docker-ce-cli-20.10.7-3.el7 containerd.io | |
# final sanity check, NOTE: docker deamon is not running and you will see an error, do not use in user_data or do one of many work arounds :) | |
docker version | |
# docker suggested test for reference https://docs.docker.com/engine/install/rhel/ | |
# sudo docker run hello-world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment