I’ve run a web service in a docker container on a custom port (8080). Here, I’m trying to run a container, exposing the relevant container’s port (as seen here), but the no avail.
docker run -p 127.0.0.1:8080:8080 beatthemarket run wait
But I can’t seem to reach that web service endpoint.
i) Am I correctly exposing the container's port? ii) How can troubleshoot if it's the port that's unavailable, or if my web service just isn't getting called (it would be nice to be able to shell into the container and just curl the endpoint).
My Dockerfile can be seen here. And I’m using Adzerk’s boot-clj base image.
Actually running docker, each time retrieves a bunch of jars. Then boot blocks (the wait
task), which is what I want (a web server will be handling web requests). And this is where I’m lost. Boot, in docker, blocks as I’ve asked it to. But I can’t seem to get the basic Hello World message that a root URI should return.
$ docker run -p 127.0.0.1:8080:8080 beatthemarket run wait
Downloading https://github.com/boot-clj/boot/releases/download/2.5.5/boot.jar...
Retrieving dynapath-0.2.3.jar from https://clojars.org/repo/
Retrieving pod-2.5.5.jar from https://clojars.org/repo/
Retrieving shimdandy-impl-1.2.0.jar from https://repo1.maven.org/maven2/
Retrieving core-2.5.5.jar from https://clojars.org/repo/
...
Implicit target dir is deprecated, please use the target task instead.
Set BOOT_EMIT_TARGET=no to disable implicit target dir.
The Chrome, curl and wget all say that the connection is refused.
$ curl http://127.0.0.1:8080/
curl: (7) Failed to connect to 127.0.0.1 port 8080: Connection refused
$ wget http://127.0.0.1:8080/
--2016-04-21 20:07:32-- http://127.0.0.1:8080/
Connecting to 127.0.0.1:8080... failed: Connection refused.