1. Here we use 5.7.29 Docker image as an example.

$ docker load -i mysql-enterprise-server-5.7.29.tar

2. You can bind OS mounts to Docker directory, assume you want to keep the audit logs under /bak/logs directory on the host.

$ docker run --name=mysql1 
--mount type=bind,src=/bak/my.cnf,dst=/etc/my.cnf 
--mount type=bind,src=/bak/data,dst=/var/lib/mysql 
--mount type=bind,src=/bak/logs,dst=/var/lib/logs 
-d mysql/enterprise-server:5.7

3. Start the mysql:

4. Start the Docker shell and install the audit log plugin:

$ docker exec -it mysql1 bash

shell> mysql -uroot -ppassword
mysql> source /usr/share/mysql/audit_log_filter_linux_install.sql

5. If you want to change the location of audit log, modify the my.cnf file:

[mysqld]

....

loose_audit_log_file=/var/lib/logs/audit.log