Docker run with root resize permissions

When I launch the docker image, the artifact directory that I mount gets root permission. I want artifacts to have the same resolution as the user. Is it possible to pass the user as an argument when launching the docker image so that it creates a catalog of artifacts with a specific user permission?

This is how I launch docker:

docker run --cap-add SYS_ADMIN --security-opt apparmor:unconfined -it -v /home/artifacts:/artifacts dock_img drwxr-xr-x 2 root root 4.0K Nov 16 13:58 artifacts 

Since this artifact receives root permission, I cannot process it from my login. Can someone help me in solving this problem?

+5
source share
1 answer

This is because you are using the root user in the container.

You can use the -u option to set the user you are using outside (for example, -u `id -u $USER` ), but if you need root inside the container, you must manually cut it off.

+3
source

Source: https://habr.com/ru/post/1259866/


All Articles