non-root docker examples.
--
build.sh,Dockerfile,run.sh,condor.sub,Dockerfile.matlab
| docker build --build-arg GROUPID=$(id -g) \ | |
| --build-arg USERID=$(id -u) \ | |
| --build-arg USERNAME=$USER \ | |
| -t okok:latest . |
| universe = docker | |
| docker_image = okok:latest | |
| executable = run.sh | |
| transfer_input_files = run.sh | |
| should_transfer_files = YES | |
| when_to_transfer_output = ON_EXIT | |
| output = log/$(cluster).$(process).out | |
| error = log/$(cluster).$(process).err | |
| log = log/$(cluster).$(process).log | |
| requirements = (Arch == "X86_64" && OpSys =="LINUX") | |
| #requirements = (Machine == "okok.edu") | |
| request_cpus = 1 | |
| request_memory = 2GB | |
| max_materialize = 1 | |
| arguments = "" | |
| queue |
| FROM pytorch/pytorch:2.2.2-cuda11.8-cudnn8-runtime | |
| ARG GROUPID | |
| ARG USERID | |
| ARG USERNAME | |
| RUN groupadd -g $GROUPID developer | |
| RUN useradd --no-log-init -u $USERID -g $GROUPID -s /bin/bash $USERNAME |
| FROM mathworks/matlab:r2024a | |
| ARG GROUPID | |
| ARG USERID | |
| ARG USERNAME | |
| USER root | |
| RUN groupadd -g ${GROUPID} mygroup | |
| RUN useradd --no-log-init -u ${USERID} -g 1000 -s /bin/bash -md /home/${USERNAME} ${USERNAME} | |
| RUN usermod -a -G ${GROUPID} ${USERNAME} | |
| RUN echo "pteng ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${USERNAME} | |
| RUN chmod 0440 /etc/sudoers.d/${USERNAME} | |
| USER ${USERNAME} | |
| WORKDIR /home/${USERNAME} | |
| ENTRYPOINT ["/bin/run.sh"] | |
| CMD [""] | |
| #!/bin/bash | |
| python -c "import getpass;print(getpass.getuser())" |