automation: introduce a new variable to control container user

Sometimes it is handy to create a container and play with its setup
manually as root.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
This commit is contained in:
Wei Liu committed 2018-09-26 09:50:17 +01:00
1 parent 99b9b0c087
commit 17fbe6504d
2 files changed
+9 -1

No files matched your search

+2
View File
@@ -50,6 +50,8 @@ understands.
- CONTAINER_ARGS: Allows you to pass extra arguments to Docker
when starting the container.
- CONTAINER_UID0: This specifies whether root is used inside the container.
- XEN_CONFIG_EXPERT: If this is defined in your shell it will be
automatically passed through to the container.
+7 -1
View File
@@ -23,6 +23,12 @@ case "_${CONTAINER}" in
_stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
esac
# Use this variable to control whehter root should be used
case "_${CONTAINER_UID0}" in
_1) userarg= ;;
_0|_) userarg="-u $(id -u)" ;;
esac
# Save the commands for future use
cmd=$@
@@ -70,7 +76,7 @@ fi
# Kick off Docker
einfo "*** Launching container ..."
exec docker run \
-u $(id -u) \
${userarg} \
${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
-v "${CONTAINER_PATH}":/build:rw \
-v "${HOME}/.ssh":/root/.ssh:ro \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.