carlessanagustin
4/13/2017 - 9:55 AM

Installs Docker Engine on a Centos 7 instance

Installs Docker Engine on a Centos 7 instance

#!/usr/bin/env bash

if [ $(uname -m) != 'x86_64' ]
then
  echo "wrong kernel version"
  exit
fi

if [ $(uname -r | awk -F'.' '{print $1}') -ge "3" ]
then
  if [ $(uname -r | awk -F'.' '{print $2}') -lt "10" ]
  then
    echo "wrong kernel version"
    exit
  fi
else
  echo "wrong kernel version"
  exit
fi

sudo groupadd docker
sudo usermod -aG docker $(whoami)

sudo tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

sudo yum -y update

sudo yum -y install docker-engine

sudo systemctl enable docker
sudo systemctl restart docker
sudo systemctl status docker