question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

container runs as root user

See original GitHub issue

The docker container is run with the root user. The kubernetes platform where I wanted to deploy this service prohibits containers from running as root user, logging in with some low-privileged user instead. This leads to some directories being inaccessible (/app/allure-report/history for example) and therefore the app can’t function fully. I believe it is considered more secure to not run as root (which is probably also why the platform is prohibiting it)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
nicodevriescommented, Jan 23, 2020

The main thing would be adding

RUN groupadd -g 999 appuser && \
    useradd -r -u 999 -g appuser appuser
USER appuser

to your dockerfile, but that’s just the start. Then you need to chown the appropriate files and directories. I am not sure how big of an impact that would have on your codebase

0reactions
fescobarcommented, Feb 5, 2020

@nicodevries did you try overriding the user/group -u 1000:1000 ? version: 2.13.1

https://github.com/DevExpress/testcafe/issues/2875#issuecomment-422730288

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running Docker Containers as ROOT: | dockerlabs - Collabnix
One of the best practices while running Docker Container is to run processes with a non-root user. This is because if a user...
Read more >
HOWTO stop running containers as root in Kubernetes
Running a container as root means that the software packaged in a container is set to start as the root, or system administrator,...
Read more >
Processes In Containers Should Not Run As Root - Medium
Most containerized processes are application services and therefore don't require root access. While Docker requires root to run, containers ...
Read more >
Understanding root inside and outside a container - Red Hat
At a high level, a rootless container engine like Podman allows you to run it as your user account. Then, inside the container,...
Read more >
Running as root on Docker images that don't use root
There are good reasons why running in a container as root is not a good idea, and that's why many images published nowadays...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found