Skip to content

Instantly share code, notes, and snippets.

@thomasfaingnaert
Created February 7, 2021 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasfaingnaert/18f16592df95e8aa3844a8826d282be9 to your computer and use it in GitHub Desktop.
Save thomasfaingnaert/18f16592df95e8aa3844a8826d282be9 to your computer and use it in GitHub Desktop.
Run command in Docker
function run_in_docker()
{
docker run --rm -i -u "$(id -u):$(id -g)" $DOCKER_IMAGE bash -s
}
# Usage:
run_in_docker <<EOF || echo "Failed!"
set -e
echo "Do something in container..."
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment