Skip to content

Commit

Permalink
Added pybamm user id to 1000 and set its group to root (pybamm-team#3947
Browse files Browse the repository at this point in the history
)

* 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>
  • Loading branch information
santacodes and agriyakhetarpal authored Apr 3, 2024
1 parent 31527b7 commit 88658cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/source/user_guide/installation/install-from-docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------

Expand Down
5 changes: 3 additions & 2 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit 88658cf

Please sign in to comment.