I have one windows and one ubuntu 22.04 OS on my device. I have a special shared partition on my harddisk that I can enter from both of the OS'es.
On the shared partition I have a docker setup and I would like it to store the mysql data (volume) in a folder inside the host folder (./mysql_data)
The disk is mounted ntfs and thus, has as permission for all files and folders 1000:1000. Now, that is not docker (gid=999) so I have a hard time getting all permissions correct. Even when I set the -user 1000:1000 flag, issues keep piling up all the time:
- corrupt files
- not being able to login into phpmyadmin
- permission issues
What would be a correct configuration for both the partition mount and the docker file?
partition mount (/etc/fstab):
UUID=xxx /mnt/share ntfs defaults,uid=1000,gid=999,fmask=0022,dmask=0000 0 0
docker-compose.yml:
version: "3.1"
services:
www:
build:
context: .
dockerfile: Dockerfile.lamp
user: 1000:1000
ports:
- "${WEBSERVER_PORT}:80"
volumes:
- ./www:/var/www/html/
links:
- db
networks:
- default
db:
image: mysql:8.0
user: 1000:1000
ports:
- "3306:3306"
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- ./sql:/docker-entrypoint-initdb.d
- ./conf:/etc/mysql/conf.d
- mysql_data:/var/lib/mysql
networks:
- default
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- db:db
ports:
- ${PHPMYADMIN_PORT}:80
networks:
- default
environment:
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
UPLOAD_LIMIT: 64M
volumes:
mysql_data:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: './mysql_data'
networks:
default:
Any suggestions to how I could successfully achieve this? given that a mount has issues with permissions and will only set permissions on all files as given by the /etc/fstab file or default 1000:1000