How to share ownership of mounted directory on docker?
The problem is located in the results directory :
PermissionError: [Errno 13] Permission denied: './results//details.txt'
but only the owner of the directory can write in :
drwxr-xr-x 9 dgx_user6 dgx_user6 4096 二 14 05:33 results
The image that you use specifies a user which the id differs from the user id of the directory owner on the host .
You can override that behavior by specifying the user (and optionally the group) when you start the container with the -u / --user
flag (see run command reference).
For example that start the container with the user and group id of the host user :
docker run --user $(id -u):$(id -g) myImage
Note that ii will work only if the user and group id in the image are the same that those of the user on the host. Default is 1000:1000.
If these id
s don't match, you should probably find a way to make the user or group id match for files you need to manipulate in both sides.