4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 cd "$(dirname "$0")"/..
22 CONT_NAME="remote-installer"
25 IMG_NAME="remote-installer"
37 echo -e "$(basename $0) [-h -a <api-port> -c <cont> -i <image> -r <pw> -s <https-port> ] -b <basedir> -e <ip-addr>"
38 echo -e " -h display this help"
39 echo -e " -a rest API port, default $API_PORT"
40 echo -e " -c container name, default $CONT_NAME"
41 echo -e " -b base directory, which contains images, certificates, etc."
42 echo -e " -e external ip address of the docker"
43 echo -e " -i secure https port, default $IMG_NAME"
44 echo -e " -p root password, default $ROOT_PW"
45 echo -e " -s secure https port, default $HTTPS_PORT"
48 while getopts "ha:b:e:s:c:p:i:" arg; do
76 error "Unknow argument!" showhelp
81 [ -n "$EXT_IP" ] || error "No external IP defined!" showhelp
82 [ -n "$BASE_DIR" ] || error "No base directory defined!" showhelp
84 cont_id="$(docker run --detach --rm --privileged \
85 --env API_PORT="$API_PORT" \
86 --env HOST_ADDR="$EXT_IP" \
87 --env HTTPS_PORT="$HTTPS_PORT" \
89 --volume "$BASE_DIR":/opt/remoteinstaller --publish "$HTTPS_PORT":"$HTTPS_PORT" -p 2049:2049 -p "$API_PORT":"$API_PORT" --name "$CONT_NAME" "$IMG_NAME")" \
90 || error "failed to start container"
92 echo -e "Container successfully started"
93 echo -e "ID : $cont_id"
94 echo -e "IP : $(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$cont_id")"