Skip to content

run application as non-root user in docker container #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2021
Merged

Conversation

m90
Copy link
Member

@m90 m90 commented Mar 18, 2021

This models the Dockerfile after the advice given here https://github.com/hexops/dockerfile which seems to make a lot of sense.

Trouble with this approach is that it will require manual interaction by users that upgrade, so we might need to wait for a proper point in time to sneak this in.

@m90
Copy link
Member Author

m90 commented Mar 18, 2021

Changing file ownership in the container would work like this:

docker exec -u 0 <container_ref> chown offen:offen /var/opt/offen/offen.db

@m90 m90 added the breaking label Mar 18, 2021
@m90 m90 force-pushed the nonroot-docker branch from 3d543b7 to 05c6eca Compare March 18, 2021 08:41
@m90
Copy link
Member Author

m90 commented Mar 18, 2021

A possible migration strategy for moving here might be:

  1. Starting with v0.4.0 we make the non-root Docker image the default, providing instructions on how to migrate. This should only affect deployments that use the Docker / SQLite combo.
  2. For the entire v0.4.x series we also provide a v0.4.x-root tag on Docker Hub that still uses the Docker Image running as root. This leaves users with a little more time to migrate while still keeping the installs up to date.
  3. Starting with v0.5.0 the image running as root is dropped. Anyone who wants to upgrade will need to run the upgrade steps against their setups.

@m90 m90 force-pushed the nonroot-docker branch from 85b151b to c40684b Compare March 18, 2021 11:27
@m90 m90 merged commit a908efc into development Mar 18, 2021
@m90 m90 deleted the nonroot-docker branch March 18, 2021 16:44
@m90 m90 mentioned this pull request Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant