Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise docker permission setup #545

Open
PGijsbers opened this issue Jun 21, 2023 · 0 comments
Open

Revise docker permission setup #545

PGijsbers opened this issue Jun 21, 2023 · 0 comments
Labels
container Issues when running in container (docker, singularity)

Comments

@PGijsbers
Copy link
Collaborator

PGijsbers commented Jun 21, 2023

#495 introduced an issue when building public images: the image is set up for the builder, but the user will start the container under a different uid, which leads to permission errors. I think we should remove any user information from the docker container, and instead create/assign permissions on startup with something like:

set -e

if [ $UID = 0 ]; then
  echo "Docker started as root, not changing file permissions."
  exit 0
fi

user_id=$UID
echo "root" | su -c "adduser --disabled-password --gecos '' -uid $user_id amlb"
echo "root" | su -c "echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"
echo "root" | su -c "chown -R amlb:amlb /home/amlb"
echo "root" | su -c "chown -R amlb:amlb /bench"
echo "root" | su -c "passwd -d amlb"
su "amlb"

And then invoking above script before running python runbenchmark.py.
This way the permissions are set for the person running the docker container, not the one building the image.

Originally posted by @PGijsbers in #495 (comment)

@PGijsbers PGijsbers added the container Issues when running in container (docker, singularity) label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
container Issues when running in container (docker, singularity)
Projects
None yet
Development

No branches or pull requests

1 participant