#!/usr/bin/env bash SCRIPT_PATH=$( cd "$(dirname "$0")" ; pwd -P ) IMAGE_NAME="mdillon/postgis" IMAGE_VERSION="9.5" PROJECT_NAME=pgsql-db source ${SCRIPT_PATH}/../common.shinc # # Project specific variables # DB_VOLUME=pgsql_persistent PORT=5432 source ${SCRIPT_PATH}/env.shinc 2> /dev/null init() { __init NETWORKS=(${DB_NETWORK}) __createNetworks __msg "Removing old postgres bin volume..." docker volume rm -f ${PGSQL_DB_BIN} && docker create \ --name ${PROJECT_NAME} \ --restart=unless-stopped \ -v ${DB_VOLUME}:/var/lib/postgresql/data \ -v ${PGSQL_DB_BIN}:/usr/lib/postgresql/${IMAGE_VERSION}/bin \ -e POSTGRES_USER=${DB_USER} \ -e POSTGRES_PASSWORD=${DB_PASSWORD} \ --net ${DB_NETWORK} \ -p ${PORT}:5432 \ ${IMAGE_NAME}:${IMAGE_VERSION} [[ $? -ne 0 ]] && return 1 __ask_to_start } "$@" exit $?