I have MySQL 5.5.44 installed native on a Lenovo X6 box with many cores, SSD, etc. /var/lib/mysql is symlinked off to a dir on an SSD.
I also have a docker 5.5.44 image present. The image is started this way:
sudo docker run --name buzz-mysql0 -v /data/2/mysqlvarlib/0:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -p 24000:3306 -d mysql:5.5
As you can see, /var/lib/mysql is volume mapped out of the container to the host on an SSD. Same SSD as the native MySQL. The host can talk to this instance on port 24000.
Both instances are out-of-the-box. No special conf options, tunings, etc.
I have a little Java program that runs in a tight loop with autoCommit(false)/commit() wrappers and inserts 6 columns of short strings and 2 dates. It uses mysql-connector-java-5.1.36-bin.jar.
Run against the MySQL at port 3306 (native), it runs at 5000 inserts/sec.
Run against the MySQL at port 24000 which is the dockerized image, it runs at only 3400 inserts/sec. That's roughly 32% slower. Only one test is run at a time and the results do not vary.
I am hoping it is a matter of some tuning and not the volume mapping or port forwarding that is contributing to the slowness. If it was 10% slower I probably wouldn't care but 32% is a bit steep.