Last active
August 18, 2018 23:11
-
-
Save keuv-grvl/911dadb17c3275f5b3ad40ced3a5e6da to your computer and use it in GitHub Desktop.
Properly run a Docker container which create files
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 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