Docker Community Forums

Share and learn in the Docker community.

How can a volume be used if the users id's in the container are different?

I want to know if it is possible that a running container can read a file (shell script) on a mounted volume at the beginning (once) to change users uid/gid?

Problem I see:
I think the first problem is that a mounted volume can’t be read/write from the container because the users id’s doesn’t match.
Second problem i see, how can a container read a file from a mounted volume?

I create images myself which I want to share, but I don’t want people to need the Dockerfile which I won’t include. However, it should be possible to change the uid and gid of the user in the container at startup or afterwards.

So I don’t know if you can do this with entrypoint and a shell script (.sh).

If possible, the container should check if a certain file exists in the mounted volume and then read and execute it.

I don’t want to share the dockerfile, where i can do the change.