Skip to content

Instantly share code, notes, and snippets.

@keuv-grvl
Last active August 18, 2018 23:11
Show Gist options
  • Save keuv-grvl/911dadb17c3275f5b3ad40ced3a5e6da to your computer and use it in GitHub Desktop.
Save keuv-grvl/911dadb17c3275f5b3ad40ced3a5e6da to your computer and use it in GitHub Desktop.
Properly run a Docker container which create files
#!/usr/bin/env bash
docker run \
--volume $(pwd):/data \
--user $(id -u $USER):$(id -g $USER) \
--entrypoint /path/to/your_program \
CONTAINER_NAME \
--input /data/inputfile --output /data/outputfile
# Will run '/path/to/your_program --input /data/inputfile --output /data/output' inside the container,
# reading '/data/inputfile' and writing to '/data/outputfile' ('./inputfile' and './outputfile' once
# you leave the container). './outputfile' will non belong to 'root' but you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment