4

Hello and thanks for taking time :)

Currently I am facing some Problems with sbt-native-packager and Docker. I'm relatively new to this. Actually, its my first try. And here comes my problem: I've got an Actor, that should respond to HTTP requests. It works fine if I run it native without Docker. Now I want it to be built as an Dockercontainer (there are serveral companions so I use docker compose). Therefore, I use sbt-native-packager but now when I hit localhost:4444 I just get "Not found". So I think there's something wrong with my dockerBuild Settings. I just can't find out what :(

Here some code:

Settings

lazy val graphiteprocSetting = eventprocSettings ++ Seq(
name := "graphite-processor",
dockerBaseImage := "nimmis/java:oracle-8-jdk",
daemonUser in Docker := "root",
debianChangelog in Debian := Some(file("*")),
mainClass in Compile := Some("*.StreamProcessorKafkaToGraphite"))

Build

 lazy val graphiteproc =  Project(                                                                          
    id = "graphiteproc",                                                                                     
    base = file("modules/graphiteproc"),                                                                     
    settings = graphiteprocSetting                               
  ).enablePlugins(DebianPlugin, JavaServerAppPackaging, DebianDeployPlugin, DockerPlugin, BuildInfoPlugin)   

Docker-compose.yml

graphiteprocessor:
  # TODO insert correct version via sbt
  image: graphite-processor:0.1.13-SNAPSHOT
  volumes:
    - ./conf:*
  environment:
    JAVA_OPTS: "-Dconfig.file=*"
  ports:
    - "4444:4444"
  links:
      - graphite
      - kafka

output of docker inspect:

"NetworkSettings": {
        ...
        "Ports": {
            "4444/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "4444"
                }
            ]
        },
        ...
        "Gateway": "172.17.0.1",
        ...
        "IPAddress": "172.17.0.2",
        "Networks": {
            "bridge": {
                ...
                "Gateway": "172.17.0.1",
                "IPAddress": "172.17.0.2",
                ...

            }
        }
    }

2 Answers2

2

using 0.0.0.0 as host and changing the base image to gdepuille/fedora-java worked for me.

1

When you build the image graphite-processor:0.1.13-SNAPSHOT did you use 'EXPOSE 4444' in the directive? If not, the port mapping -p 4444:4444 will have no effect.

Slack Flag
  • 816
  • 8
  • 15
  • I tried it with dockerExposedPorts in Docker := Seq(4444). But it did not help. – Cem Philipp Freimoser Dec 18 '15 at 15:23
  • How are you running Docker? If it's in a bootstrapper such as docker-machine, then 'localhost' is not valid outside of the helper VM. For example if you're using docker-machine, you have to figure out the right IP by running 'docker-machine env'. – Slack Flag Dec 18 '15 at 16:52
  • I am not sure if I get you right. Docker is running locally on my machine, no docker-machine and no creepy network settings (other docker images are reachable via localhost). I also tried using 127.0.0.1. Also no luck with that. – Cem Philipp Freimoser Dec 18 '15 at 17:03
  • Last guess would be either a local firewall, or double check that you did rebuild and run the right tag where you tried with dockerExposedPorts. – Slack Flag Dec 18 '15 at 17:35