-
Notifications
You must be signed in to change notification settings - Fork 19
Fix Docker Permissions #102
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
base: main
Are you sure you want to change the base?
Conversation
/data and /app directories removed chown for /app it was not needed
4e863b9 to
f20d00d
Compare
|
After further testing, i found you only need to create the /data directory and chown it to app:app chown-ing the /app directory seems to be redundant if the data directory is writable. I've updated the PR to represent this |
|
Does this approach still work if you mount a docker volume to I would have assumed that this |
|
yes i was able to use the docker compose example in the readme. Mounting a volume to /data My understanding is /data would be owned by root and where its been switched to run as the app user (1001) we no longer have access to write to /data I was going to chown /data to app:app only. but because the container hadn't started yet it wasn't created, so i found i had to create it first in the build stage After that mounting works normal. I haven't tried using it with a bind mount yet but i can attempt that |
|
Yes it seems to work for both a docker volume as stated in the example compose as such services:
tsidp:
container_name: tsidp
image: ghcr.io/tailscale/tsidp:latest
volumes:
- tsidp-data:/data
environment:
- TAILSCALE_USE_WIP_CODE=1 # tsidp is experimental - needed while version <1.0.0
- TS_STATE_DIR=/data # store persistent tsnet and tsidp state
- TS_HOSTNAME=idp # Hostname on tailnet (becomes idp.your-tailnet.ts.net)
- TSIDP_ENABLE_STS=1 # Enable OAuth token exchange
# Optional: Tailscale auth key for automatic node registration
# - TS_AUTHKEY=tskey-auth-xxxxx
volumes:
tsidp-data:or using a bind mount like so services:
tsidp:
container_name: tsidp
image: ghcr.io/tailscale/tsidp:latest
volumes:
- ./test_data:/data
environment:
- TAILSCALE_USE_WIP_CODE=1 # tsidp is experimental - needed while version <1.0.0
- TS_STATE_DIR=/data # store persistent tsnet and tsidp state
- TS_HOSTNAME=idp # Hostname on tailnet (becomes idp.your-tailnet.ts.net)
- TSIDP_ENABLE_STS=1 # Enable OAuth token exchange
# Optional: Tailscale auth key for automatic node registration
# - TS_AUTHKEY=tskey-auth-xxxxx
in my test i substituted the image file with my own built from the dockerfile i suggested edit: |
|
Nice! My last concern is that your change bakes the Maybe just propose removing this environment variable and specify |
|
To achieve the ability to let the user pick a directory with an environment I made these 2 changes to the main branch ##DockerFile
-RUN apk --no-cache add ca-certificates
+RUN apk --no-cache add ca-certificates su-exec
-USER app:app ##scripts/docker/run.sh
+if [ -n "$TS_STATE_DIR" ]; then
+ mkdir -p "$TS_STATE_DIR"
+ chown app:app "$TS_STATE_DIR"
+fi
+
-exec /tsidp-server $ARGS "$@"
+su-exec app:app /tsidp-server $ARGS "$@"
if this seems like the route i can add the PR for it instead If you want to run the whole entrypoint as app user though i believe you would have to not allow the user to pick the internal folder for the docker location and just do a Volume in the dockerfile? |
Docker file creates /data directory and sets permissions for app to write to /data and /app directories
resubmit of #101
fixes #95
fixes #96