mlcube icon indicating copy to clipboard operation
mlcube copied to clipboard

Docker runs as root (mnist_openfl example)

Open msheller opened this issue 4 years ago • 2 comments

When I follow the mnist_openfl example, the container runs as root. This also means that all output files are set to root ownership, and are thus unwriteable by other users.

I modified the example to have separate model_in and model_out directories so that I could overwrite the model_in without being root. here you can see the root ownership:

~/git/mlcube_examples/mnist_openfl/workspace/model_out(master*) » ll
total 4.0K drwxr-xr-x 4 root root 4.0K Jul 13 15:18 mnist_model

msheller avatar Jul 20 '21 17:07 msheller

This is generally an issue with mounted volumes in docker as the docker daemon runs as root. If relative volumes are mounted you need to take care in the docker container how you set the user id and group id.

One approach I have taken in other projects is to pass Linux user and group id (usually $UID/$GID) into the container and write with those ids. That will than have the correct user permissions on the host system which should be desirable for mlcube I think.

This should probably be resolved when the following options --user $(id -u):$(id -g) are added to this string: https://github.com/mlcommons/mlcube/blob/master/runners/mlcube_docker/mlcube_docker/docker_run.py#L85

tanertopal avatar Jul 28 '21 20:07 tanertopal

We should make this very obvious in the docs so that people don't run into permissions issues.

relja128 avatar Oct 22 '21 16:10 relja128