Docker for Maс is toooo slow for development

Hello! I try to setup dev env. All works, but to slow…
my docker-compose.yml
nginx:
build: ./nginx/
ports:
- 80:80
links:
- php
volumes:
# - ./nginx/setup.sh:/opt/setup.sh
- ./code:/var/www/
- ./nginx/admin.local.conf:/etc/nginx/conf.d/admin.local.conf
- ./nginx/www.local.conf:/etc/nginx/conf.d/www.local.conf
php:
build: ./php/
expose:
- 9000
links:
- couchbase
- mysql
- memcache
volumes:
- ./code/www:/var/www/www
- ./code/admin:/var/www/admin
couchbase:
build: ./couchbase/
ports:
- 8091-8094:8091-8094
- 11210:11210
volumes:
- ./couchbase/data/:/opt/couchbase/var/
mysql:
build: ./mysql/
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: dbuser
MYSQL_PASSWORD: 123123
MYSQL_DATABASE: test_dev
ports:
- 3306:3306
volumes:
- ./mysql/sql:/docker-entrypoint-initdb.d
- ./mysql/data:/var/lib/mysql
memcache:
image: memcached:latest
ports:
- 11211:11211

my docker info
$ docker info
Containers: 5
Running: 5
Paused: 0
Stopped: 0
Images: 16
Server Version: 1.12.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 56
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: overlay host null bridge
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.20-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.953 GiB
Name: moby
ID: YAKM:2YWM:M74F:JYKA:YEGK:TIUF:JHZ7:ODRB:DUDR:EGAE:YPT4:3FMA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 44
Goroutines: 88
System Time: 2016-11-03T18:02:45.715767115Z
EventsListeners: 2
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8

my speed tests.
$ docker exec -it docker_php_1 bash
root@179fa3adc5e1:/var/www/html# cd /
root@179fa3adc5e1:/# time dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 0.792141 s, 129 MB/s

real	0m0.800s
user	0m0.050s
sys	0m0.530s
root@179fa3adc5e1:/# cd /var/www/www/
root@179fa3adc5e1:/var/www/www# time dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 59.1859 s, 1.7 MB/s

real	0m59.197s
user	0m0.200s
sys	0m2.920s

How can i improve it? Thanks.

Docker for Mac’s current implementation of osxfs is incredibly slow if you are mounting volumes.

This is our work around:

1 Like

thanks. i try it, but it is not comfortableю So decide move to docker-machine for now.

Our team has developed a GO app that manages docker-machine and provides a solid developer toolkit across mac, windows and linux:

The primary goals of docker-workbench are;

  • To make it easy to create Docker machines in VirtualBox with sensible defaults (CPUs, disk size, RAM, etc)
  • To make it easy to run multiple containerised web applications without managing DNS, hosts files or ports
  • To provide a standard /workbench shared folder to allow docker-compose volumes work the same for multiple users, cross-platform
  • To allow mobile, tablet and other network devices to easily access the containerised applications

Enjoy!

Upgrade to the latest beta, and make sure you perform a “reset to factory defaults”.

That will get you overlayfs2 which should speed things up.