docker pull kovacshuni/riptube:1.0.0-SNAPSHOT
docker run -it -P --name="riptube" kovacshuni/riptube:1.0.0-SNAPSHOT
bin/riptube &
curl -X POST -d "Hi there" localhost:8082/notify
INFO 15:55:06 c.h.r.NotificationReceiver$ - Hi there

因此,这工作。但是从外部,从docker守护程序的主机,却没有。尽管有EXPOSE命令和-P参数。
docker port riptube 8082
0.0.0.0:32785
curl -X POST -d "Hi there" localhost:32785/notify
curl: (52) Empty reply from server

为什么? :( :(

源代码here。 Dockerfile也是如此,但是粘贴在下面:
 FROM frolvlad/alpine-oraclejdk8

 RUN apk add --update bash py-pip ca-certificates curl
 RUN rm -rf /var/cache/apk/*
 RUN pip install youtube-dl

 WORKDIR /opt/riptube
 ADD target/pack/ /opt/riptube
 EXPOSE 8082
 ENTRYPOINT /bin/bash
 CMD

最佳答案

我有同样的问题:

替换为:

private val httpBindingF = Http().bindAndHandle(ripController.route, "localhost", 8080)

有了这个:
private val httpBindingF = Http().bindAndHandle(ripController.route, "0.0.0.0", 8080)

令人惊讶的是,它为我工作!

10-08 12:53