21.6.15

Play with Play Framework within Docker

1. Installation

https://www.playframework.com/documentation/2.4.x/Installing

I ran a Java 8 docker container and copied typesafe-activator-1.3.5.zip to the target container. Thanks to boot2docker, /Users director in Mac has already been mount to boot2docker host, and I could simply do a cp command between my Mac host system and the container file system.

2. Port forwarding

https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md

According to this link, I ran the following command to forward port 8888 on my Mac to my target container's port 8888.

Firstly I need to find out the IP address of the target container:

boot2docker ssh docker inspect <container name> | grep Address

        "MacAddress": "",
        "GlobalIPv6Address": "",
        "IPAddress": "172.17.0.42",
        "LinkLocalIPv6Address": "fe80::42:acff:fe11:2a",

        "MacAddress": "02:42:ac:11:00:2a",

172.17.0.42 was the one I needed.

boot2docker ssh -vnNTL 8888:172.17.0.42:8888

Done

3. Start activator and have it listen on 0.0.0.0:8888 instead of 127.0.0.1:8888


According to this post:

$activator -Dhttp.address=0.0.0.0 -Dhttp.port=8888 ui


No comments: