[GH-ISSUE #149] Add PUID/PGID ENV var support in Dockerfile #69

Closed
opened 2026-04-08 16:50:09 +03:00 by zhus · 2 comments
Owner

Originally created by @NERVEbing on GitHub (Dec 8, 2022).
Original GitHub issue: https://github.com/sigoden/dufs/issues/149

Specific Demand

Add PUID/PGID ENV var support in Dockerfile.

Implement Suggestion

If the process is running under root, all files and directories created during the container's lifespan will be owned by root, thus becoming inaccessible by users, this is important for NAS.

Thank you.

Originally created by @NERVEbing on GitHub (Dec 8, 2022). Original GitHub issue: https://github.com/sigoden/dufs/issues/149 ## Specific Demand Add PUID/PGID ENV var support in Dockerfile. ## Implement Suggestion If the process is running under root, all files and directories created during the container's lifespan will be owned by root, thus becoming inaccessible by users, this is important for NAS. Thank you.
zhus closed this issue 2026-04-08 16:50:09 +03:00
Author
Owner

@sigoden commented on GitHub (Dec 8, 2022):

use user to specific uid:pid of running process.

docker run -u $(id -u):$(id -g) -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data -A
version: '3'
services:
  dufs:
    image: sigoden/dufs
    ports:
    - 5000:5000
    volumes:
    - .:/data
    command: /data -A
    user: "1000:1000"
<!-- gh-comment-id:1342221464 --> @sigoden commented on GitHub (Dec 8, 2022): use `user` to specific uid:pid of running process. ``` docker run -u $(id -u):$(id -g) -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data -A ``` ``` version: '3' services: dufs: image: sigoden/dufs ports: - 5000:5000 volumes: - .:/data command: /data -A user: "1000:1000" ```
Author
Owner

@NERVEbing commented on GitHub (Dec 8, 2022):

use user to specific uid:pid of running process.

docker run -u $(id -u):$(id -g) -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data -A
version: '3'
services:
 dufs:
   image: sigoden/dufs
   ports:
   - 5000:5000
   volumes:
   - .:/data
   command: /data -A
   user: "1000:1000"

It works!

<!-- gh-comment-id:1342230568 --> @NERVEbing commented on GitHub (Dec 8, 2022): > use `user` to specific uid:pid of running process. > > ``` > docker run -u $(id -u):$(id -g) -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data -A > ``` > > ``` > version: '3' > services: > dufs: > image: sigoden/dufs > ports: > - 5000:5000 > volumes: > - .:/data > command: /data -A > user: "1000:1000" > ``` It works!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#69