Have installed docker and the container for tensorflow with GPU following Docker | TensorFlow. The container launched fine at first but warned that it should be launched by the user instead because of shared files being owned by root.
I’m using v2.15 because this what I have running locally, and I want to use models tested locally in the container.
docker run -u $(id -u):$(id -g) -it -p 8888:8888 tensorflow/tensorflow:2.15.0.post1-gpu
results in “/sbin/ldconfig.real: Can’t create temporary cache file /etc/ld.so.cache~: Permission denied”
I’ve googled around without success. I don’t want to run docker with sudo.
Advice appreciated!
Maybe you can change the permissions of /etc.
Will look into this and report back
1 Like
Tried running the same command with sudo. I get the same permission denied error. So it doesn’t seem to be a simple permission issue
EDIT: Clarity
OK, so now I’m feeling stupid
There’s a message above the Tensorflow ASCII art when I start with -u -g : “You are running this container as user with ID 1000 and group 1000, which should map to the ID and group for your user on the Docker host. Great!”
So the solution seems to be to have the same user id and group in the container…
- Does it run if you remove
-u $(id -u):$(id -g) ?
You still do not need sudo for starting the container.
Yes, you’re right. But adding
<RUN groupadd -r -g 2200 user_name && useradd -rM -g user_name -u 2200 user_name
in the Dockerfile avoids the “permission denied” problem when I pass my username and group