From eaebdc30a5cb189ffeecde698017564bc9c90b8e Mon Sep 17 00:00:00 2001 From: Julien Maupetit Date: Wed, 4 Sep 2019 16:13:41 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(project)=20add=20bin/compose=20shortc?= =?UTF-8?q?ut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using raw docker-compose commands, the UID and GID environment variables are supposed to be defined. Hence, to avoid having a warning message (and potential errors), one should use the following command: UID=$(id -u) GID=$(id -g) docker-compose To ease our life, we've added a bin/compose script that can be used as a shortcut for a configured docker-compose command. --- bin/compose | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 bin/compose diff --git a/bin/compose b/bin/compose new file mode 100755 index 00000000..2e3e3567 --- /dev/null +++ b/bin/compose @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Only define UID & GID variables if they are not. Note that we cannot rely on +# bash variable substitution default value as, when defined, the UID and GID +# variables are read-only variables. +if [[ -z ${UID} ]]; then + UID=$(id -u) +fi + +if [[ -z ${GID} ]]; then + GID=$(id -g) +fi + +export UID +export GID + +docker-compose "${@}"