34 lines
935 B
Bash
Executable File
34 lines
935 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SUV_ID=$(hexdump -vn8 -e'2/4 "%08x" 1 "\n"' /dev/urandom)
|
|
SUV_NAME=i-0$SUV_ID
|
|
|
|
echo "Building SUV $SUV_NAME ..."
|
|
|
|
# *** DO NOT REMOVE THE FIRST DOT ***
|
|
SUV_DOMAINNAME=".privatesuv.com"
|
|
|
|
# build the image (i.e. 'mocha suv init' )
|
|
docker build -t mocha-httpd -f mocha-suv/docker/Dockerfile .
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "'docker build' failed; is it properly installed?"
|
|
exit 2
|
|
|
|
fi
|
|
|
|
docker network create --driver=bridge --subnet=10.7.0.0/16 --ip-range=10.7.0.0/24 --gateway=10.7.0.1 mocha-docker
|
|
|
|
# initiate a container (i.e. 'mocha suv up i-0...' )
|
|
# docker run --name $SUV_NAME -d -p 8000:80 --net mocha-docker mocha-httpd # -p 8000:80 mocha-httpd
|
|
|
|
# docker inspect $SUV_NAME
|
|
# SUV_IP=$(docker container exec $SUV_NAME hostname -i)
|
|
|
|
# echo "Enter administrative password to add entry to /etc/hosts file if wanted"
|
|
# echo -e "$SUV_IP\t\t$SUV_NAME$SUV_DOMAINNAME" | sudo tee -a /etc/hosts
|
|
|
|
# echo "$SUV_NAME : $SUV_IP"
|
|
|