Skip to content

Run the Docker container as a non-root user #46

@milancurcic

Description

@milancurcic

The container currently runs code as a root user which provides possibility to break the running instance of the container, at least until the Python server process is restarted. Let's create a non-root user in the Docker image and use that to run code. Perhaps something like this:

ENV USERNAME=fortran
RUN useradd \
  --no-log-init \
  --home-dir /home/$USERNAME \
  --create-home \
  --shell /bin/bash \
  $USERNAME
USER $USERNAME
WORKDIR /home/$USERNAME

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity-related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions