$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
26137efa979f mysql "docker-entrypoint..." 8 months ago Up 10 minutes 0.0.0.0:3306->3306/tcp container-mysql
$ sudo docker exec container-mysql mysqld --version`
mysqld Ver 5.7.15 for Linux on x86_64 (MySQL Community Server (GPL))
$ sudo docker exec container-mysql cat /etc/mysql/mysql.conf.d/mysqld.cnf
$ sudo docker cp container-mysql:/etc/mysql/mysql.conf.d/mysqld.cnf ~/mysqld.cnf
$ sudo nano ~/mysqld.cnf`
[mysqld]
skip-host-cache
skip-name-resolve
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
#log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Slow query settings:
slow_query_log=1
slow_query_log_file=/var/log/mysql/slow.log
long_query_time=0.1
character-set-server=utf8mb4
[client]
default-character-set=utf8mb4
$ sudo docker cp ~/mysqld.cnf container-mysql:/etc/mysql/mysql.conf.d/mysqld.cnf
$ sudo docker restart container-mysql
$ sudo docker exec container-mysql cat /var/log/mysql/slow.log
I think it is better to install logrotate daemon inside the container to handle it.