0

My host is linux. In linux I'm logged in as a hostuser(id=1745118974). I'm running a docker container (image downloaded from dockerhub). There is an user dockeruser(id=1001) inside the container.

I want to use tools available from container. And I need to mount the data from my host for the tools.

So I'm doing

docker run -it --rm -v $HOME/data:/data imagename:tag bash

And the issue is that /data inside the container is now owned by uid=1745118974,gid=1745118974 . And dockeruser(id=1001) cannot read or write it.

How do I configure my run so I can read/write the data on host as hostuser and read/write the data from inside the container as dockeruser?

Thank you

Ivan Dives
  • 477
  • 5
  • 9
  • `docker run -u $(id -u)` will propagate the current host user ID into the container. [write in shared volumes docker](https://stackoverflow.com/questions/29245216/write-in-shared-volumes-docker) has some discussion of this. – David Maze Sep 06 '22 at 11:24

0 Answers0