coderaiser / cloudcmd

✨☁️📁✨ Cloud Commander file manager for the web with console and editor.
https://cloudcmd.io
MIT License
1.83k stars 257 forks source link

Add PUID & PGID settings docker #302

Closed Toomblr closed 3 years ago

Toomblr commented 3 years ago

It would be nice to run container as user. Because all new files/folders are now created as root. Aside from the security concerns this brings along.

robflate commented 3 years ago

I add user: 1000:1000 (or whatever your UID and GID are) to my docker compose.

Toomblr commented 3 years ago

@robflate Like this: ` cloudcmd: image: coderaiser/cloudcmd container_name: cloudcmd environment:

Cause that doesn't work for me. Could be my own fault.

robflate commented 3 years ago

This is a cutdown version of my compose;

  cloudcmd:
    container_name: cloudcmd
    image: coderaiser/cloudcmd:latest
    restart: unless-stopped
    volumes:
      - /path/to/cloudcmd:/root
      - /path/to/root:/mnt/fs
    environment:
      CLOUDCMD_ROOT: /mnt/fs
    user: 1000:1000

I create and CHOWN (1000:1000) the config folder /path/to/cloudcmd before running for the first time.

Toomblr commented 3 years ago

@robflate

I did it like this, according to your compose example:

  cloudcmd:
    image: coderaiser/cloudcmd
    container_name: cloudcmd
    environment:
      - DOCKER_USER= myusername
      - CLOUDCMD_AUTH=false
      - CLOUDCMD_USERNAME=$CLOUDCMD_USERNAME
      - CLOUDCMD_PASSWORD=$CLOUDCMD_PASSWORD
      - user:1000:1000  
    security_opt:
      - no-new-privileges:true
    volumes:
      - ~:/root
      - /vol0:/vol0
      - /:/mnt/fs
    networks:
      t2_proxy:
        ipv4_address: 192.168.90.26

Sadly, this doesn't make a difference

robflate commented 3 years ago

Check my compose again and how it’s formatted. user: 1000:1000 is not an env var like you’ve got, it should be on the same indent level as environment:. It shouldn’t start with -either.

https://docs.docker.com/compose/compose-file/#domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir

Toomblr commented 3 years ago

Thanks @robflate ! That indeed fixed it. You have my gratitude.