Skip to content

Instantly share code, notes, and snippets.

@glehmann
Last active January 21, 2024 08:57
Show Gist options
  • Save glehmann/3d5d416bc76e3bb1fcad6eaaa0be86bb to your computer and use it in GitHub Desktop.
Save glehmann/3d5d416bc76e3bb1fcad6eaaa0be86bb to your computer and use it in GitHub Desktop.
creating files with the expected uid/gid in a docker local volume
glehmann@gbook:/tmp/test$ docker run -v .:/app alpine touch /app/foo
glehmann@gbook:/tmp/test$ ls -lh
total 0
-rw-r--r-- 1 root root 0 janv. 21 09:48 foo
glehmann@gbook:/tmp/test$ docker run -u $(id -u):$(id -g) -v .:/app alpine touch /app/bar
glehmann@gbook:/tmp/test$ ls -lh
total 0
-rw-r--r-- 1 glehmann glehmann 0 janv. 21 09:48 bar
-rw-r--r-- 1 root root 0 janv. 21 09:48 foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment