You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Total Docker newbie here, hope you'll help me out.
Using this image with
$ docker run --rm -it -v "$SRC_PATH":/src -v "$TARGET_PATH":/target klakegg/hugo:0.51
I end up with a $TARGET_PATH folder owned by root, since Docker seems to write files to the shared volume on the host side, using the user/group id of the container user.
Trying to use the --user option, as I've seen suggested in a couple of other places, the container is unable to write to it's /target
$ docker run --rm --user "$(id -u):$(id -g)" -it -v "$SRC_PATH":/src -v "$TARGET_PATH":/target klakegg/hugo:0.51
Building sites … ERROR 2018/11/17 00:46:41 open /target/index.html: permission denied
ERROR 2018/11/17 00:46:41 mkdir /target/tags: permission denied
ERROR 2018/11/17 00:46:41 mkdir /target/tags: permission denied
ERROR 2018/11/17 00:46:41 mkdir /target/tags: permission denied
Total in 3 ms
Error: Error copying static files: chtimes /target/: operation not permitted
Of course this isn't the end of the world, since you could just chown the output, but I'm both lazy and curious as to how this might be worked around.
Total Docker newbie here, hope you'll help me out.
Using this image with
I end up with a
$TARGET_PATH
folder owned by root, since Docker seems to write files to the shared volume on the host side, using the user/group id of the container user.Trying to use the
--user
option, as I've seen suggested in a couple of other places, the container is unable to write to it's/target
Of course this isn't the end of the world, since you could just
chown
the output, but I'm both lazy and curious as to how this might be worked around.I did find jguyomard/docker-hugo, which kind of works around the issue by creating a user whoms home directory is set to the shared source folder, which just coincidentally has the same user id as most people using the image. This just seems like kind of a hack in my opinion.
What would be the right way to handle this whole thing?
The text was updated successfully, but these errors were encountered: