Categories
docker docker-compose macos mysql

Docker. MySQL image. Can’t change my.cnf file

I have such a docker-compose.yml:

    database:
container_name: test_db
image: mysql:5.7
volumes:
- ./docker/my.cnf:/etc/my.cnf
environment:
- "MYSQL_ROOT_PASSWORD=root"
- "MYSQL_DATABASE=test_db"
ports:
- "3306:3306"
volumes:
- test_db_data:/var/lib/mysql
volumes:
test_db_data:

and I want to edit the sql_mode.

./docker/my.cnf contains:

[mysqld]
sql_mode=""

But when I connect to db from my local machine and run SELECT @@sql_mode; I receive:

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

What am I doing wrong?