This commit is contained in:
Wenkai Yin 2016-11-29 11:29:50 +08:00
parent 871c18df46
commit 4149e74b00
4 changed files with 49 additions and 3 deletions

View File

@ -90,4 +90,45 @@ function configureHarborCfg {
then then
sed -i -r s%"#?$cfg_key\s*=\s*.*"%"$cfg_key = $cfg_value"% $cfg_file sed -i -r s%"#?$cfg_key\s*=\s*.*"%"$cfg_key = $cfg_value"% $cfg_file
fi fi
}
function configureDockerDNS {
echo "Resetting DNS using vami_ovf_process..."
/opt/vmware/share/vami/vami_ovf_process --setnetwork || true
sed -n -e 's/^nameserver //p' /etc/resolv.conf > /tmp/dns
readarray dns < /tmp/dns
opts=""
for d in "${dns[@]}"
do
if [ -n "$d" ]
then
opts="--dns=$d $opts"
fi
done
rm /tmp/dns
domain=$(sed -n -e 's/^domain //p' /etc/resolv.conf)
if [ -n "$domain" ]
then
opts="--dns-search=$domain $opts"
fi
search=$(sed -n -e 's/^search //p' /etc/resolv.conf)
if [ -n "$search" ]
then
searcharray=($search)
for s in "${searcharray[@]}"
do
if [ -n "$s" ]
then
opts="--dns-search=$s $opts"
fi
done
fi
echo Setting docker: $opts
echo DOCKER_OPTS=$opts > /etc/default/docker
systemctl restart docker
} }

View File

@ -139,7 +139,7 @@ function detectHostname {
# echo "Get hostname from ovfenv: $hostname" # echo "Get hostname from ovfenv: $hostname"
# return # return
#fi #fi
echo "Resetting DNS and hostname using vami_ovf_process..." echo "Resetting hostname using vami_ovf_process..."
/opt/vmware/share/vami/vami_ovf_process --setnetwork || true /opt/vmware/share/vami/vami_ovf_process --setnetwork || true
hostname=$(hostname --fqdn) || true hostname=$(hostname --fqdn) || true
if [ -n $hostname ] if [ -n $hostname ]

View File

@ -25,8 +25,10 @@ addIptableRules
echo "Installing docker compose..." echo "Installing docker compose..."
installDockerCompose installDockerCompose
echo "Starting docker service..." #echo "Starting docker service..."
systemctl start docker #systemctl start docker
echo "Configuring docker..."
configureDockerDNS
echo "Uncompress Harbor offline instaler tar..." echo "Uncompress Harbor offline instaler tar..."
tar -zxvf $base_dir/../harbor-offline-installer*.tgz -C $base_dir/../ tar -zxvf $base_dir/../harbor-offline-installer*.tgz -C $base_dir/../

View File

@ -33,6 +33,9 @@ fi
echo "Configuring Harbor..." echo "Configuring Harbor..."
configure configure
echo "Configuring docker..."
configureDockerDNS
#Start Harbor #Start Harbor
echo "Starting Harbor..." echo "Starting Harbor..."
up up