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
- .workspace/postgres/pgdata:/pgdata
========= 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
- 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)
- Run docker compose.