From 88658cfcaed8a244eee4743aaae170d85f1f4c57 Mon Sep 17 00:00:00 2001 From: Santhosh <52504160+santacodes@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:18:30 +0530 Subject: [PATCH] Added pybamm user id to 1000 and set its group to root (#3947) * added pybamm user id to 1000 and set the group to root * added sudo and appended pybamm to sudoers * added docs for adding pybamm user to root and sudoers group * Update docs/source/user_guide/installation/install-from-docker.rst Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --------- Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --- .../source/user_guide/installation/install-from-docker.rst | 7 +++++++ scripts/Dockerfile | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/source/user_guide/installation/install-from-docker.rst b/docs/source/user_guide/installation/install-from-docker.rst index 82f75bebf4..1d49ae8f54 100644 --- a/docs/source/user_guide/installation/install-from-docker.rst +++ b/docs/source/user_guide/installation/install-from-docker.rst @@ -85,6 +85,13 @@ Once you have pulled the Docker image, you can run a Docker container with the P 3. You can execute PyBaMM-related commands, run tests develop & contribute from the container. +.. note:: + + The default user for the container is ``pybamm`` with ``pybamm`` as password. The user belongs to + ``sudoers`` and ``root`` group, so the sudo command can be issued to install additional packages to + the container. After a clean install, ``sudo apt-get update`` should be executed to update the source + list. Additional packages can be installed using ``sudo apt-get install [package_name]``. + Exiting the Docker container ---------------------------- diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 888f5f197d..152c8f01d9 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -3,10 +3,11 @@ FROM continuumio/miniconda3:latest WORKDIR / RUN apt-get update && apt-get -y upgrade -RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng +RUN apt-get install -y libopenblas-dev gcc gfortran graphviz git make g++ build-essential cmake pandoc texlive-latex-extra dvipng sudo RUN rm -rf /var/lib/apt/lists/* -RUN useradd -m -s /bin/bash pybamm +RUN useradd -m -s /bin/bash pybamm && echo "pybamm:pybamm" | chpasswd && adduser pybamm sudo +RUN usermod -ou 1000 -g 0 pybamm USER pybamm WORKDIR /home/pybamm/