Merge "Update docker build for EL7"
[releng/builder.git] / vagrant / docker / bootstrap.sh
1 #!/bin/bash
2
3 # vim: sw=4 ts=4 sts=4 et :
4
5 rh_changes() {
6     # make sure we're fully updated
7     echo "---> Updating OS"
8     yum clean all
9     yum update -y -q
10
11     # install docker and enable it
12     echo "---> Installing docker"
13     yum install -y docker supervisor bridge-utils
14     systemctl enable docker
15
16     # configure docker networking so that it does not conflict with LF
17     # internal networks
18     cat <<EOL > /etc/sysconfig/docker-network
19 # /etc/sysconfig/docker-network
20 DOCKER_NETWORK_OPTIONS='--bip=10.250.0.254/24'
21 EOL
22
23     # docker group doesn't get created by default for some reason
24     groupadd docker
25 }
26
27 ubuntu_changes() {
28     # make sure we're fully updated
29     echo "---> Updating OS"
30     apt-get update
31     apt-get upgrade -y -qq
32 }
33
34 OS=`/usr/bin/facter operatingsystem`
35 case "$OS" in
36     CentOS|Fedora|RedHat)
37         rh_changes
38     ;;
39     Ubuntu)
40         ubuntu_changes
41     ;;
42     *)
43         echo "${OS} has no configuration changes"
44     ;;
45 esac
46
47 echo "***************************************************"
48 echo "*   PLEASE RELOAD THIS VAGRANT BOX BEFORE USE     *"
49 echo "***************************************************"