Sign inSign up

mastersign/run-as-user

By mastersign

•Updated over 8 years ago

This image solves the problem of file permissions and file owners with mounted volumes.

Image
0

230

mastersign/run-as-user repository overview

⁠run-as-user Base Docker Container

This project is an implementation of the approach from https://denibertovic.com/posts/handling-permissions-with-docker-volumes/⁠.

It solves the problem of file permissions and file owners with mounted volumes.

The project contains Dockerfiles for different base images.

This solution is only necessary, if the intention of your container is to process files on a mounted volume. This can be temporarily during development or permanently if you are developing some kind of CLI tool container.

⁠Flavors

  • mastersign/run-as-user:node-6-alpine → node:6-alpine
  • mastersign/run-as-user:ubuntu → phusion/baseimage

⁠Usage

Use a Dockerfile with the run-as-user image as base:

FROM mastersign/run-as-user:<flavor>
CMD ["/bin/bash"]

Build the image:

docker build -t myimage .

Run it with fall-back user:

docker run -it myimage
Starting with UID: 9001
user@056b9bb45214:/$ id
uid=9001(user) gid=9001(user) groups=9001(user)
exit

Run it with your host user:

docker run -it -e LOCAL_USER_ID=`id -u $USER` myimage
Starting with UID : 1000
user@fc07b6c32b4f:/$ id
uid=1000(user) gid=1000(user) groups=1000(user)

⁠Acknowlegment

Thanks to Deni Bertović for his insightful post about Handling Permissions with Docker Volumes!

⁠License

This project is published under the MIT license.

Copyright © by Tobias Kiertscher [email protected]⁠.

Tag summary

Content type

Image

Digest

Size

80.9 MB

Last updated

over 8 years ago

docker pull mastersign/run-as-user:ubuntu