Docker for Windows very slow (networking?, host directory as a volume?)

We’ve got a docker-compose setup that runs three containers:

  1. web server with WordPress
  2. database server with MariaDB
  3. Node.js application that the WordPress site talks to

All containers have mapped volumes like this:

  wp:
    image: our/wp
    ports:
      - "80:80"
    volumes:
     - ./blog_data:/var/www/html

  db:
    image: mysql:latest
    ports:
      - "3306:3306"
    volumes:
      - ./db_data:/var/lib/mysql

  node:
    image: our/node-app
    ports:
      - "3000:3000"
    volumes:
      - ./node_data:/usr/share/node-data-dir

The WordPress site uploads some of its files to the Node.js server via HTTP so there’s quite a bit of networking and file operations involved.

When I run this, it is extremely slow on Docker for Windows. For comparison, these are times per one upload operation as we tried them:

  • Linux: ~0.6s
  • Docker for Mac: ~3s
  • Docker for Windows: ~40s

I get that everything is slower on Windows, and my machine is not as powerful as colleague’s Mac, however, the difference seems too large.

Any ideas if this is “normal” and I should get 10x slower experience than on Docker for Mac (which is also virtualized and not as fast as Linux)? Is there something obviously wrong with my docker-compose.yml? I’m quite new to Docker.

1 Like

I had a similar issue with Docker + Windows + Wordpress. It turns out that it was the DNS that was too slow. One of the plugins that I had was making a remote call with cURL. And every request took more than 5 seconds to execute at which point the timeout kicks in and drops the execution. There were a couple of calls like this one during the request. So all in all it too my wordpress about 80 seconds to load.

I fixed the issue by removing all the nameserver’s in /etc/resolv.conf and replace them with 8.8.8.8 (google’s). After that I ran “/etc/init.d/networking force-reload” and voila - quick and fast wordpress installation.

Maybe this is the case for you too.

If you have time, could you build a (preferably) small reproducible test case that we can run too? Then we can figure out where the bottleneck is for you scenario, and start improving.

I’ll try to create a small repro during the holidays.

Hi, any progress?
I’m running WordPress under docker on Windows and it’s also slower than on Mac. :confused:

I also experience major slowness with docker-compose in docker for windows:
docker run myservice goes instantly (with all options from the docker-compose.yml file passed in as CLI paramters)
docker-compose run myservice takes almost a minute before even seeing the very first line in the output (starting myservice...)

changing the DNS to google’s 8.8.8.8 in the docker setting panel doesn’t make any difference.
Any one more ideas what could make this so slow? How can I get more info (logs,…) to see what’s going on behind the scenes?

Since the previous update of docker for windows (17.03.1-ce-win5 (10743)) docker-compose suddenly became “lightning fast” in my case