Mac host doesn't like Docker container port forwarding

The Dockerfile doesn't expose 9200 to the daemon. Add

EXPOSE 9200

to the Dockerfile before ENTRYPOINT


Assuming you are using Docker Toolbox and not the beta ...

There is a 3 step process for exposing a port properly:

  • use EXPOSE 8080 where 8080 is just a port number in the Dockerfile
  • use -p 8080:8080 in your docker run command
  • Make sure that you setup port forwarding in Oracle Virtual Box so that the boot2docker machine is able to receive requests from port 8080.

This applies to both Windows and OSX where Docker Toolbox is being used. Linux doesn't use Oracle VirtualBox to run docker so those hosts do not need to do the third point


I ran your repo as-is on Docker 1.12 on OSX.

If you look carefully at your container startup:

2016-08-29 20:52:31.028  INFO 5 --- [           main] o.eclipse.jetty.server.ServerConnector   : Started ServerConnector@47949d1a{HTTP/1.1}{0.0.0.0:8080}
2016-08-29 20:52:31.033  INFO 5 --- [           main] .s.b.c.e.j.JettyEmbeddedServletContainer : Jetty started on port(s) 8080 (http/1.1)

Although application.yml and Dockerfile both contain 9200, the application is starting on 8080