My docker-compose can’t find the current user and, instead of using him as the owner of created volumes, it sets a random other user on the system as the owner.
Here’s my docker-compose.yaml:
version: "3"
services:
# Database
db:
image: mysql:5.7
volumes:
- ./db_data:/var/lib/mysql
- ./mysql-custom.cnf:/etc/mysql/conf.d/mysql-custom.cnf
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
- wpsite
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8080:80"
environment:
PMA_HOST: db
PMA_PORT: "3310"
PMA_PORTS: "3310"
MYSQL_ROOT_PASSWORD: password
networks:
- wpsite
# WordPress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
volumes:
- "./wp:/var/www/html"
- "./custom-php.ini:/usr/local/etc/php/conf.d/custom-php.ini"
environment:
WORDPRESS_DB_HOST: db:3310
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- wpsite
networks:
wpsite:
When creating the volume, random users are taken as the owners of the local attached folders:
Bash:
-rw-rw-r-- 1 caesar caesar 46 May 5 08:33 custom-php.ini
drwxr-xr-x 2 ollama root 4096 May 5 08:41 db_data
-rw-rw-r-- 1 caesar caesar 1066 May 5 08:41 docker-compose.yaml
-rw-rw-r-- 1 caesar caesar 21 May 5 08:33 mysql-custom.cnf
drwxr-xr-x 5 www-data www-data 4096 May 5 08:41 wp
I already tried specifying a $UID and a hardcoded user in the docker-compose.yaml, but to no avail… my current user is not found.
Finally, I do exist:
caesar@debian:/media/data/repos/test/wp-gigi$ getent passwd | grep caesar
caesar:x:1000:1000:Caesar,,,:/home/caesar:/bin/bash