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

Change id of local matlab user for permissions #124

Open
arunoruto opened this issue Oct 14, 2024 · 1 comment
Open

Change id of local matlab user for permissions #124

arunoruto opened this issue Oct 14, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@arunoruto
Copy link

I am currently implementing a small bash script, which would launch an individual Matlab instance per user via Docker. Here is my current progress, and I can launch it for all three "versions" (X11, browser, VNC):

#!/usr/bin/env bash

IMAGE="mathworks/matlab"
VERSION="r2024b"
LICENCE="<path to licence file>"

SHM_SIZE="512M"

COMMAND_END=""
COMMAND_PARAM="-e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix:ro"
if [ -z "${1}" ]; then
  xhost +
else
  case $1 in
    "browser")
    COMMAND_PARAM='-p 8888:8888'
    COMMAND_END='-browser'
    ;;

    "vnc")
    COMMAND_PARAM='-p 5901:5901 -p 6080:6080'
    COMMAND_END='-vnc'
    ;;

    *)
    echo "'${1}' is not a valid flag. Please use 'browser' or 'vnc' for the respective protocoll or nothing for X11"
    exit 1
    ;;
  esac
fi

eval 'docker run --init -it --rm \
  ${COMMAND_PARAM} \
  --user ${UID}:${GID} \
  -e MLM_LICENSE_FILE="/network.lic" \
  -v ${LICENCE}:/network.lic \
  -v ${HOME}:/home/matlab/workdir \
  --shm-size=${SHM_SIZE} \
  ${IMAGE}:${VERSION} \
  ${COMMAND_END}'

When running the script (with VNC), I get the following permission error:

/bin/run.sh: 51: cannot create //.bashrc: Permission denied

Is there a way to make these things available for any user/group ID? Or are there any security reasons for doing so?
It would be nice to change the user ID inside the container without building a new image per user :)

@michaelmcdonnellmw michaelmcdonnellmw self-assigned this Oct 24, 2024
@michaelmcdonnellmw michaelmcdonnellmw added the enhancement New feature or request label Oct 24, 2024
@michaelmcdonnellmw
Copy link
Member

Hi @arunoruto

Thanks for highlighting your use case for setting the UID and GID at run time in the container, this is something that we are investigating and will feed back here when we have more information on the matter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants