Container with mount is extremely slow and choking the host

Expected behavior

My containers should get going quickly, like they do in Linux. Specifically, my Tomcat container should be fully initialized with my application in a minute or so.

Actual behavior

Tomcat takes forever to start, hardly any logs being printed out meaning it’s almost completely hung, and my Mac seems to be struggling (fan is going crazy).
Last line of Tomcat’s catalina.out log is “INFO: Deploying web application directory”, then nothing happens for a long time other than fan noise.
After a few minutes (!!!) I get the Tomcat localhost log to tell me that Spring is starting to load my app, at this stage there is usually a whole bunch of log prints spewing out - but nothing in this Docker for Mac environment.
Eventually I killed it after a few more minutes, feeling pity for my poor Mac.

Information

MacBook Pro (13-inch, Late 2011), 2.8 GHz Intel Core i7, 8GB memory, OSX version 10.11.3

========= Here is my Docker Compose setup:
db:
image: “postgres:9.4”
ports:

  • “15432:5432”
    volumes:
    • .workspace/postgres/pgdata:/pgdata
      environment:
      POSTGRES_PASSWORD: “bar”
      POSTGRES_USER: “foo”
      PGDATA: “/pgdata”
      POSTGRES_DB: “bla”
      server:
      image: “my-dev-server”
      ports:
    • “8080:8080”
    • “5050:5050”
    • “19010:9010”
      volumes:
    • .workspace/server/tomcat/webapps:/usr/share/tomcat/default/webapps
    • .workspace/server/tomcat/logs:/usr/share/tomcat/default/logs
    • .workspace/server/tomcat/conf/app.base.config.xml:/usr/share/tomcat/default/conf/app.base.config.xml
    • .workspace/server/tomcat/conf/app.properties:/usr/share/tomcat/default/conf/app.properties
    • .workspace/server/tomcat/conf/log4j.properties:/usr/share/tomcat/default/conf/log4j.properties
      links:
    • db

========= Here is my server Dockerfile:
FROM centos:7.2.1511
RUN yum install -y logrotate initscripts less
ADD rpms /rpms
RUN rpm -i /rpms/jre-.rpm /rpms/myapp-.rpm
VOLUME /usr/share/tomcat/default/logs
VOLUME /usr/share/tomcat/webapps
ENV JAVA_HOME /usr/java/default
ENV PATH ${JAVA_HOME}/bin:${PATH}
ENV CATALINA_HOME /usr/share/tomcat/default
ENV MEM_AMNT=3000
ENV CATALINA_OPTS=“-XX:-UseSplitVerifier -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Xmx$[MEM_AMNT]m -XX:MaxPermSize=512m -Djava.security.egd=file:/dev/./urandom”
ENV JAVA_OPTS=“-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false”
ENV JPDA_TRANSPORT dt_socket
ENV JPDA_ADDRESS 5050
ENTRYPOINT exec ${CATALINA_HOME}/bin/catalina.sh jpda run

=========== Pinata output:
OS X: version 10.11.3 (build: 15D21)
Docker.app: version v1.11.0-beta9
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160505-104839.tar.gz
Most specific failure is: No error was detected
Your unique id is: B938D73D-AD93-4870-AAFE-192989DFDF84
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. Create a server docker file running Tomcat, where you mount the webapp directory and a few init files from the host (see my Dockerfile for the server above)
  2. Run docker compose.
1 Like

Same for me. Ruby on Rails app. Loading page takes 2-3 minutes. With parallels desktop driver it takes up to 10 seconds, usually 2-3 sec.

Here is a relevant thread that has had a lot of activity

https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076

docker 1.11.1-beta11 still same issue; completely unusable.

Upgraded to docker 1.11.1-beta12, still experiencing the same issue. If I’m using a mount it’s painfully slow.

Same here, though I would add that its slightly better than .beta11. Still far from the virtualbox nfs docker-machine I have configured.

Seems to be related to this other post that’s far more in-depth. File access in mounted volumes extremely slow, CPU bound

Appears to be down to the performance of osxfs being used for the volume mounts.

Try this.