From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from integral2.. (unknown [182.2.72.31]) by gnuweeb.org (Postfix) with ESMTPSA id 059EB7E7C9; Sat, 30 Apr 2022 17:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1651338541; bh=2R588JEHCcf/1txNFcLNIYvdsoceVuDB+bd+W5WN5I0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5sZvgOScDJuQU35vMK9mnRYEpkZj42/Gw3O7yErTKWRwME+nQyChijHq4ZJk9Yc3 V3wfUfFaggQyladjeMpFzyFZcOnxE3sgnMhjLp98YP/7eWpxjEnnFkM0E6BAcb2/DD MvcHoUm6f92rQLBFLkMVWY5bmxmmB532OGRvjekdw1JSovoOHud5rvr5EmdHQ4N0hT boNikttY7dQjXG3aCujDnRr1nAinVaRNpbD/TOYd1Gk53eS5LLyDGCQMAqGYvD/diw Hf3qQxS2RxV8vLws7O2yKLErJBXQcEsiQ1WviuPo8U6WtAHBiV9v/RHzs/F/5DPDTS uZvpIyA9JiOQw== From: Ammar Faizi To: Hazmi Alfarizqi , GNU/Weeb Mailing List Cc: Ammar Faizi , Hazmi Alfarizqi , Alviro Iskandar Setiawan Subject: [PATCH server-a001 v2 4/4] Create start.sh to start the docker container Date: Sun, 1 May 2022 00:08:38 +0700 Message-Id: <20220430170838.19571-5-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220430170838.19571-1-ammarfaizi2@gnuweeb.org> References: <20220430170838.19571-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Create a file named start.sh. This is a script to start the container with prepared configuration. Only run this script on the host. Signed-off-by: Ammar Faizi --- start.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 start.sh diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..19f1eef --- /dev/null +++ b/start.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# This file is run in this host, not in the container. +# + +set -e; + +HOSTNAME="gnuweeb.org"; +CONTAINER_NAME="server-a001-ct"; +MYSQL_DATA_DIR="$(readlink -e "./storage/mysql_data")"; + +mkdir -pv "$MYSQL_DATA_DIR"; + + +CMD="$1"; + +if [[ "${CMD}" == "force-run" ]]; then + docker rm -f "${CONTAINER_NAME}" || true; + CMD="run"; +fi; + +if [[ "${CMD}" == "run" ]]; then + docker run \ + --name "${CONTAINER_NAME}" \ + --privileged \ + --hostname "${HOSTNAME}" \ + --mount "type=volume,dst=/var/lib/mysql,volume-driver=local,volume-opt=type=none,volume-opt=o=bind,volume-opt=device=${MYSQL_DATA_DIR}" \ + --tty \ + --interactive \ + --detach \ + server-a001; + + exit 0; +fi; + +echo "Unknown command ${CMD}!"; +exit 1; -- Ammar Faizi