#!/bin/bash -x # Copyright 2018 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # export DEBIAN_FRONTEND=noninteractive echo "__host_private_ip_addr__ $(hostname)" >> /etc/hosts printenv mkdir -p /opt/config echo "__docker_version__" > /opt/config/docker_version.txt echo "__nfs_ip_addr__" > /opt/config/nfs_ip_addr.txt echo "__nfs_private_ip_addr__" > /opt/config/nfs_private_ip_addr.txt echo "__host_private_ip_addr__" > /opt/config/host_private_ip_addr.txt echo "__mtu__" > /opt/config/mtu.txt mkdir -p /etc/docker if [ ! -z "__docker_proxy__" ]; then cat > /etc/docker/daemon.json < /etc/docker/daemon.json < /etc/apt/apt.conf.d/30proxy < /dev/null; do apt-get -y update # apt-get -y dist-upgrade apt-get -y install curl jq nfs-common sleep 10 done # install docker while ! hash docker &> /dev/null; do curl https://releases.rancher.com/install-docker/__docker_version__.sh | sh systemctl enable docker usermod -aG docker ubuntu sleep 10 done # Enable autorestart when VM reboots update-rc.d k8s_vm_init_serv defaults