Skip to content

Commit 4360283

Browse files
committed
Vagrantfile: added ability to install Docker EE (specifed version) on centos
Signed-off-by: Bill Robinson <[email protected]>
1 parent 51e5f6f commit 4360283

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Vagrantfile

+14-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ BEGIN {
1818
go_version = ENV['GO_VERSION'] || '1.7.6'
1919
docker_version = ENV['CONTIV_DOCKER_VERSION'] || '1.12.6'
2020
docker_swarm = ENV['CONTIV_DOCKER_SWARM'] || 'classic_mode'
21+
docker_ee_url = ENV['DOCKERURL']
2122
gopath_folder = '/opt/gopath'
2223
http_proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || ''
2324
https_proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ''
@@ -27,7 +28,7 @@ v2plugin_name = ENV['CONTIV_V2PLUGIN_NAME'] || 'contiv/v2netplugin:0.1'
2728
cluster_store_driver = ENV['CONTIV_CLUSTER_STORE_DRIVER'] || 'etcd'
2829
cluster_store_url = ENV['CONTIV_CLUSTER_STORE_URL'] || 'http://localhost:2379'
2930
nightly_release = ENV['NIGHTLY_RELEASE'] || ''
30-
node_os = ENV['CONTIV_NODE_OS'] || 'centos'
31+
node_os = ENV['CONTIV_NODE_OS'] != '' ? ENV['CONTIV_NODE_OS'] : 'centos'
3132
base_ip = ENV['CONTIV_IP_PREFIX'] || '192.168.2.'
3233
num_nodes = ENV['CONTIV_NODES'].to_i == 0 ? 3 : ENV['CONTIV_NODES'].to_i
3334
num_vm_cpus = (ENV['CONTIV_CPUS'] || 4).to_i
@@ -95,6 +96,16 @@ rm -rf /var/lib/docker
9596
if [[ "#{node_os}" == "ubuntu" ]] && [[ "$reinstall" -eq 1 ]]; then
9697
sudo apt-get purge docker-engine -y || :
9798
curl https://get.docker.com | sed s/docker-engine/docker-engine=#{docker_version}-0~xenial/g | bash
99+
elif [[ "#{node_os}" == "centos" ]] && [[ -n "#{docker_ee_url}" ]]; then
100+
echo "Preparing for Docker EE installation"
101+
sudo yum remove -y docker docker-common docker-selinux docker-engine-selinux docker-engine docker-ce || :
102+
sudo rm /etc/yum.repos.d/*docker*
103+
export DOCKERURL='#{docker_ee_url}'
104+
sudo -E sh -c 'echo "$DOCKERURL/centos" > /etc/yum/vars/dockerurl'
105+
sudo -E yum-config-manager --add-repo "$DOCKERURL/centos/docker-ee.repo"
106+
echo "Installing Docker EE #{docker_version}"
107+
sudo yum -y install docker-ee-#{docker_version}
108+
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
98109
elif [[ "$reinstall" -eq 1 ]] && [[ "#{legacy_docker}" -eq 1 ]]; then
99110
# cleanup openstack-kilo repo if required
100111
yum remove docker-engine -y || :
@@ -107,6 +118,7 @@ elif [[ "$reinstall" -eq 1 ]] && [[ "#{legacy_docker}" -eq 1 ]]; then
107118
curl https://get.docker.com | sed s/docker-engine/docker-engine-#{docker_version}/ | bash
108119
fi
109120
elif [[ "$reinstall" -eq 1 ]]; then
121+
echo "Installing Docker CE #{docker_version}"
110122
yum remove docker-engine -y || :
111123
yum remove docker-ce || :
112124
yum-config-manager --disable openstack-kilo
@@ -130,7 +142,7 @@ else
130142
fi
131143
132144
# setup docker remote api
133-
mkdir /etc/systemd/system/docker.service.d
145+
mkdir -p /etc/systemd/system/docker.service.d
134146
echo "[Service]" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
135147
echo "Environment=\\\"no_proxy=$CLUSTER_NODE_IPS,127.0.0.1,localhost,netmaster\\\" \\\"http_proxy=$http_proxy\\\" \\\"https_proxy=$https_proxy\\\"" | sudo tee -a /etc/systemd/system/docker.service.d/http-proxy.conf
136148
sudo systemctl daemon-reload

0 commit comments

Comments
 (0)