I have a docker compose as such that starts a MySQL db:
version: '3.9'
services:
mysql_db:
container_name: mysql_db
image: mysql
volumes:
- mysql_data:/var/lib/mysql
- /root/mysql/my.cnf:/etc/my.cnf
environment:
- MYSQL_ROOT_PASSWORD=pass
volumes:
mysql_data:
name: mysql_data
Note that /root/mysql/my.cnf is an empty file in the host and /etc/my.cnf is a non empty file with default configurations for MYSQL server. I was expecting that files on the host behave the same as empty directories on the host, if they are empty they get populated by the files present in the directory on the container.
The goal is here to add some configuration to allow mysql to receive incoming connections from all addresses.
If my file root/mysql/my.cnf has this line:
[mysqld]
bind-address = 0.0.0.0
it will basically overwrite all default configuration into etc/my.conf