Docker Community Forums

Share and learn in the Docker community.

Attached local folder has "systemd-bus-proxy/999" ownership

version: '3.7'
        services:
          db:
            image: mariadb
            volumes:
              - ./data:/var/lib/mysql
            restart: on-failure
            environment:
              MYSQL_ROOT_PASSWORD: example
              MYSQL_DATABASE: ttdb
              MYSQL_USER: ttdb
              MYSQL_PASSWORD: ttdb
          adminer:
            image: adminer
            restart: on-failure
            ports:
              - 8081:8080

The above is compose.yml file . After docker-compose -f compose.yml up , everything runs fine .
But the ownership of local folder ./data is as follows:

drwxrwxr-x. 5 systemd-bus-proxy user424 4.0K Jul 25 18:44 data
this is for centos7

drwxrwxr-x 5 999 glb-ban-420 ? 4096 Aug 1 14:13 data
this is for ubuntu 16.04

I am using Centos7 and ubuntu 16.04 .is there any options to change ownership in compose file for locally mounted directories?

Inside mariadb dockerfile . They are adding system user using this command.

RUN groupadd -r mysql && useradd -r -g mysql mysql

By default , system reserves 999 for system user [ -r option ] inside container .
In centos7 , 999 is reserved to systemd-bus-proxy user [ local system ].
In ubuntu 16 , no system users are with id 999 [ local system ] so folder ownership shows 999 .