Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Docker on CentOS
- #
- # Check Prerequisites
- #
- # Check CentOS 7.X
- cat /etc/issue
- echo "Make sure you see CentOS 7 or terminate the script with Ctrl-C"
- sleep 20
- #
- # Check 64-bit
- uname –a
- echo "Make sure you see 64 bit or terminate the script with Ctrl-C"
- sleep 20
- #
- # Check kernel > 3.10
- cat /proc/version
- uname -r
- echo "Make sure you see Kernel version 3.10 or higher or terminate the script with Ctrl-C"
- sleep 20
- #
- # Check root privileges
- if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root"
- exit 1
- fi
- #
- # Set SELinux DISABLED for future purposes
- sed -i 's!SELINUX=enabled!SELINUX=disabled!g' /etc/selinux/config
- #
- # Check fully update system
- yum update -y
- #
- # Add the yum repo.
- cat >/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
- #
- # fully update system (again)
- yum update -y
- #
- # Install the Docker package.
- yum install docker-engine -y
- #
- # Start the Docker daemon.
- service docker start
- #
- # Start the docker daemon at boot
- chkconfig docker on
- #
- # Verify docker is installed correctly by running a test image in a container.
- docker run hello-world
- #
- # To try something more ambitious, you can run an Ubuntu container with:
- docker run -it ubuntu bash
Advertisement
Add Comment
Please, Sign In to add comment