[refactor][fix] Cleanup docker_install

This commit is contained in:
William Wernert
2020-04-18 18:19:27 -04:00
parent 2ab1fa75ee
commit 076f161c35

View File

@@ -522,51 +522,39 @@ disable_misc_network_features() {
docker_install() { docker_install() {
if [ $OS == 'centos' ]; then if [ $OS == 'centos' ]; then
yum clean expire-cache yum clean expire-cache
yum -y install yum-utils device-mapper-persistent-data lvm2 openssl yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum -y update
yum -y update yum -y install docker-ce
yum -y install docker-ce python36-docker
if [ $INSTALLTYPE == 'MASTER' ] || [ $INSTALLTYPE == 'EVAL' ]; then
docker_registry
echo "Restarting Docker" >> "$SETUPLOG" 2>&1
systemctl restart docker
systemctl enable docker
else else
docker_registry if [ "$INSTALLTYPE" == 'MASTER' ] || [ "$INSTALLTYPE" == 'EVAL' ]; then
echo "Restarting Docker" >> "$SETUPLOG" 2>&1 apt-get update >> "$SETUPLOG" 2>&1
systemctl restart docker if [ $OSVER != "xenial" ]; then
systemctl enable docker apt-get -y install docker-ce python3-docker >> "$SETUPLOG" 2>&1
else
apt-get -y install docker-ce python-docker >> "$SETUPLOG" 2>&1
fi
else
{
apt-key add "$TMP"/gpg/docker.pub;
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable";
apt-get update;
} >> "$SETUPLOG" 2>&1
if [ $OSVER != "xenial" ]; then
apt-get -y install docker-ce python3-docker >> "$SETUPLOG" 2>&1
else
apt-get -y install docker-ce python-docker >> "$SETUPLOG" 2>&1
fi
fi
fi fi
docker_registry
else {
echo "Restarting Docker";
if [ $INSTALLTYPE == 'MASTER' ] || [ $INSTALLTYPE == 'EVAL' ]; then systemctl restart docker;
apt-get update >> "$SETUPLOG" 2>&1 systemctl enable docker;
if [ $OSVER != "xenial" ]; then } >> "$SETUPLOG" 2>&1
apt-get -y install docker-ce python3-docker >> "$SETUPLOG" 2>&1
else
apt-get -y install docker-ce python-docker >> "$SETUPLOG" 2>&1
fi
docker_registry >> "$SETUPLOG" 2>&1
echo "Restarting Docker" >> "$SETUPLOG" 2>&1
systemctl restart docker >> "$SETUPLOG" 2>&1
else
apt-key add $TMP/gpg/docker.pub >> "$SETUPLOG" 2>&1
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" >> "$SETUPLOG" 2>&1
apt-get update >> "$SETUPLOG" 2>&1
if [ $OSVER != "xenial" ]; then
apt-get -y install docker-ce python3-docker >> "$SETUPLOG" 2>&1
else
apt-get -y install docker-ce python-docker >> "$SETUPLOG" 2>&1
fi
docker_registry >> "$SETUPLOG" 2>&1
echo "Restarting Docker" >> "$SETUPLOG" 2>&1
systemctl restart docker >> "$SETUPLOG" 2>&1
fi
fi
} }
docker_registry() { docker_registry() {
@@ -574,9 +562,10 @@ docker_registry() {
echo "Setting up Docker Registry" >> "$SETUPLOG" 2>&1 echo "Setting up Docker Registry" >> "$SETUPLOG" 2>&1
mkdir -p /etc/docker >> "$SETUPLOG" 2>&1 mkdir -p /etc/docker >> "$SETUPLOG" 2>&1
# Make the host use the master docker registry # Make the host use the master docker registry
echo "{" > /etc/docker/daemon.json printf '%s\n'\
echo " \"registry-mirrors\": [\"https://$MSRV:5000\"]" >> /etc/docker/daemon.json "{"\
echo "}" >> /etc/docker/daemon.json " \"registry-mirrors\": [\"https://$MSRV:5000\"]"\
"}" > /etc/docker/daemon.json
echo "Docker Registry Setup - Complete" >> "$SETUPLOG" 2>&1 echo "Docker Registry Setup - Complete" >> "$SETUPLOG" 2>&1
} }