henrydenhengst

Install Docker on CentOS 7.X

Nov 21st, 2014
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.36 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Docker on CentOS
  4. #
  5. # Check Prerequisites
  6. #
  7. # Check CentOS 7.X
  8. cat /etc/issue
  9. echo "Make sure you see CentOS 7 or terminate the script with Ctrl-C"
  10. sleep 20
  11. #
  12. # Check 64-bit
  13. uname –a
  14. echo "Make sure you see 64 bit or terminate the script with Ctrl-C"
  15. sleep 20
  16. #
  17. # Check kernel > 3.10
  18. cat /proc/version
  19. uname -r
  20. echo "Make sure you see Kernel version 3.10 or higher or terminate the script with Ctrl-C"
  21. sleep 20
  22. #
  23. # Check root privileges
  24. if [[ $EUID -ne 0 ]]; then
  25.    echo "This script must be run as root"
  26.    exit 1
  27. fi
  28. #
  29. # Set SELinux DISABLED for future purposes
  30. sed -i 's!SELINUX=enabled!SELINUX=disabled!g' /etc/selinux/config
  31. #
  32. # Check fully update system
  33. yum update -y
  34. #
  35. # Add the yum repo.
  36. cat >/etc/yum.repos.d/docker.repo <<-EOF
  37. [dockerrepo]
  38. name=Docker Repository
  39. baseurl=https://yum.dockerproject.org/repo/main/centos/7
  40. enabled=1
  41. gpgcheck=1
  42. gpgkey=https://yum.dockerproject.org/gpg
  43. EOF
  44. #
  45. # fully update system (again)
  46. yum update -y
  47. #
  48. # Install the Docker package.
  49. yum install docker-engine -y
  50. #
  51. # Start the Docker daemon.
  52. service docker start
  53. #
  54. # Start the docker daemon at boot
  55. chkconfig docker on
  56. #
  57. # Verify docker is installed correctly by running a test image in a container.
  58. docker run hello-world
  59. #
  60. # To try something more ambitious, you can run an Ubuntu container with:
  61. docker run -it ubuntu bash
Advertisement
Add Comment
Please, Sign In to add comment