I have a separate user for LGSM related docker images on my server. Following the new docker-compose examples from https://github.com/GameServerManagers/docker-gameserver/tree/main, the default linuxgsm user in the docker image has the default UID 1000, which leads to the mounted volumes changing ownership to the host user with UID 1000, which isn't the UID of my LGSM host user (note, I'm using bind mounts).
To retain the original host ownerships, I tried using the UID and GID environment variables in the docker-compose file to match the ones of my LGSM host user. This however leads to permission errors when installing the gameserver and fetching lgsm scripts, as the /app directory permissions are set to UID 1000.
Fixing this would be pretty straightforward by adding another chown to the entrypoint.sh, that changes ownership of /app to the UID and GID provided by docker compose.
version: '3.4'
services:
linuxgsm:
image: gameservermanagers/gameserver:mc
container_name: mc_test
volumes:
- /home/gameservers/mc_test:/data
restart: unless-stopped
environment:
- UID=1006
- GID=1007
- USER=linuxgsm