Docker Community Forums

Share and learn in the Docker community.

Slow mysql import on windows

(Skione) #1

I am importing a mysqldump file into a mysql container from the command line. I am on Windows 10 pro and using the latest stable version of docker. The command does appear to be executing but takes WAY longer than booting the same container on a linux or mac host. Additionally sometimes the command never exits even though the dump has finished importing. I tried setting autocommit off, along with unique and foreign key checks and it appeared to move a little faster but ultimately it appears to get slower the further into the import. Any ideas?

(Michael Friis) #2

Thanks for reporting!

Can you provide more details on how you’re running the import? I’m guessing mysql is in a container, and you’re running the import from the windows 10 host? Does the mysql container have the data volume mounted from the Windows 10 host?

(Skione) #3

I am running this from a command prompt in windows.

docker exec -i mysql mysql -uroot -proot magento < .\bootstrap\magento.localhost.sql

I had restarted the docker service and the import appeared to go a little faster after that but it still failed to quit at the end. It looked like it was stuck but I went into the mysql container in another tab and I could see that the dump file to finish successfully.

(Michael Friis) #4

To test, could you try copying in the file to the container and running the import from there (to try to see if the problem is isolated to passing data over stdin)

(Skione) #5

Total noob question but how do you copy a file from the local host to the container?

(Michael Friis) #6

You can bake the file in during container build, or use docker cp:

(Skione) #7

Right, so copying the file into the container and then running the import works much more like I would expect it to. Why is that? Is there something in windows that would be interfering? I have already disabled UAC as a troubleshooting measure and I have the entire docker folder excluded by the antivirus as well as the folder which contains the containers. Is this something with Hyper-v? I have notice it appears to not be quite as “friendly” as virtual box. I am not sure the making the new version of docker hyper-v only makes a lot of sense to me thus far. Anyway, you could call this a solution and I appreciate your help and reading through the above rant.

(Michael Friis) #8

Docker for Windows proxies network traffic between guest and host. This solves a number of reliability issues (for example related to interference from VPNs and dropouts when you change networks).

It may be that this is a performance bottleneck in the proxy. We’re tuning it, and I’ll add a note about your usecase so we can optimize for that too.

Thanks for reporting!

(Skione) #9

I have to restart the containers everytime I go to a new network FYI

(Cs96and) #10

Possibly related to this issue?

Does com.docker.slirp.exe consume your CPU when it’s doing the import?