I used docker-compose up
with the following docker-compose.yml
version: '3.5'
services:
mysql-server:
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=root_pwd
volumes:
- ./var/lib/mysql:/var/lib/mysql:rw
The directory ./var/lib/mysql
does not exist initially.
After running docker-compose up
..
ls -al ./var/lib/mysql
command shows all the files with user:group
999:999
.
I cannot find user or group called 999
in my system.
Why docker-compose
chooses to create files with a non-existing uid:gid ?
In my case, I cannot commit the specific directory unless I change ownership. But even when I do, on a next run, docker-compose up
updates the ownership again to 999:999
.
What is the solution to the above problem? e.g. Is there a way to instruct docker-compose to map files in host machine with a specific uid:gid pair?
Host: ubuntu-18.04
docker-compose: 1.22.0