Skip to content
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

Run container with different user #79

Closed
Feriman22 opened this issue Jan 15, 2024 · 4 comments
Closed

Run container with different user #79

Feriman22 opened this issue Jan 15, 2024 · 4 comments

Comments

@Feriman22
Copy link
Contributor

Hi,

How can I define Group ID and User ID in Docker Compose to change the permissions of files uploaded to a volume? Is there a variable to do this?

Thanks,
Feriman

@elhoce
Copy link

elhoce commented Jan 18, 2024

Hi, same problem, when i change user et group id via user option, i got the following errors :

tp-server | addgroup: permission denied (are you root?)
ftp-server | adduser: permission denied (are you root?)
ftp-server | chown: unknown user/group ftpuser:ftpuser
ftp-server | chpasswd: permission denied (are you root?)
ftp-server | touch: /var/log/vsftpd.log: Permission denied
ftp-server | tail: can't open '/var/log/vsftpd.log': No such file or directory
ftp-server | tail: no files
ftp-server | touch: /var/log/xferlog: Permission denied
ftp-server | tail: can't open '/var/log/xferlog': No such file or directory
ftp-server | tail: no files
ftp-server exited with code 0

@elhoce
Copy link

elhoce commented Jan 18, 2024

Finally, I discovered a workaround. By default, the UID and GID are set to 1000:1000. However, you can override these values using the UID and GID environment variables. For example, in my docker-compose.yml file.

version: '3.7'
services:
ftp:
container_name: ftp-server
image: garethflowers/ftp-server
environment:
- 'FTP_USER=${FTP_USERNAME}'
- 'FTP_PASS=${FTP_PASSWORD}'
- 'UID=996'
- 'GID=995'
restart: always
ports:
- '20-21:20-21/tcp'
- '40000-40009:40000-40009/tcp'
volumes:
- '/stock/scan/files:/home/${FTP_USERNAME}'

@Feriman22
Copy link
Contributor Author

Thx, it works for me too!

@garethflowers
Copy link
Owner

Added a quick note for the UID and GID environment variables in the ReadMe.

See 056f99a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants