Skip to content

Non root user "breaks" dokku-volume #133

@michaelshobbs

Description

@michaelshobbs

Wasn't sure where this should go, so I'm starting here.

When the non-root user feature came to be, /exec was modified to chown -R <user>:<group> /app but we do not have a way to extend this behavior to other mounted volumes in dokku (and I assume any other extension of buildstep)...

example:

  1. install dokku
  2. install https://github.com/ohardy/dokku-volume
root@dokku:~/dokku# dokku volume:add app /myappcache
root@dokku:~/dokku# dokku run app bash
u22374@0e95e1326e0c:~$ ls -lad /myappcache
drwxr-xr-x 2 1002 1002 4096 Feb 10 16:50 /myappcache
u22374@0e95e1326e0c:~$ touch /myappcache/foo
touch: cannot touch '/myappcache/foo': Permission denied

Should this be solved once in buildstep vs. several times throughout the plugin community or is this out of scope?

Currently dokku-logging-supervisord implemented a solution like this.

# Change ownership of /var/log/app to non-root container user
APP_USER=$(stat -c %U /app)
APP_GROUP=$(stat -c %G /app)
if [[ -n "$APP_USER" ]] && [[ -n "$APP_GROUP" ]]; then
  chown -R "${APP_USER}:${APP_GROUP}" /var/log/app
  chmod -R g+rw /var/log/app
fi

Just to throw an initial spitball out, what if plugins set/update a config variable that is a list of container paths and /exec chowns those as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions