How to set uid and gid in Docker Compose?
Try this
So, you need to put:
user: "${UID}:${GID}"
in your docker compose and provide UID and GID as docker-compose parameter
UID=${UID} GID=${GID} docker-compose up
(or define UID and GID as environment variables).
This can be done as well
In your docker-composer.yml
user: $DOCKER_USER
In the command line
echo 'export DOCKER_USER="$(id -u):$(id -g)"' >> ~/.bash_profile
source ~/.bash_profile
docker-compose up
Created a DOCKER_USER variable and added it in the bash_profile for persistency. The source will help the shell to recognize changes of .bash_profile on demand