Created
March 11, 2021 17:53
-
-
Save cwensel/f78f5d53c0c7ece03943c76a985b19a7 to your computer and use it in GitHub Desktop.
Docker CLI Wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
APP_NAME="app" | |
USER_OPT=$(id -u $(logname)):$(id -g $(logname)) | |
if [ -n "${ENTRY_BASH}" ]; then | |
ENTRY_OPT="--entrypoint /bin/bash" | |
fi | |
export AWS_CREDENTIAL_PROFILES_FILE="${HOME}/.aws/credentials" | |
docker run --interactive --tty --rm ${ENTRY_OPT} \ | |
--name "$APP_NAME" \ | |
--workdir "$PWD" \ | |
--volume "$HOME":"$HOME" \ | |
--env "HOME" --env "USER" --env "AWS_CREDENTIAL_PROFILES_FILE" \ | |
--user "$USER_OPT" \ | |
--pid host \ | |
[image] \ | |
"$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment