1

我正在尝试通过调用以下方法使用 docker 图像设置本地 dbpedia 聚光灯服务器:

sudo docker run -i -p 2222:80 dbpedia/spotlight-english spotlight.sh

图像运行,我在提示时得到这个sudo docker ps

CONTAINER ID        IMAGE                       COMMAND             CREATED              STATUS              PORTS                  NAMES
02282289ae64        dbpedia/spotlight-english   "/bin/sh"           About a minute ago   Up About a minute   0.0.0.0:2222->80/tcp   sleepy_meninsky

但是当我发送一个简单的请求时:

curl http://0.0.0.0:2222/rest/annotate?text=COOPER+Has+the+FBI+said+anything+about+a+reward+or+anything+%5C%3F+Because+there+was+that+there+was+a+reward+for+finding+her&confidence=0.5

甚至一个带有标题集的:

curl -X POST http://localhost:2222/rest/annotate -H 'accept: application/json' -H 'content-type: application/x-www-form-urlencoded' --data-urlencode "text=President Obama called Wednesday on Congress to extend a tax break for students included in last year's economic stimulus package, arguing that the policy provides more generous assistance" --data-urlencode "confidence=0.35"

我犯了同样的错误:

curl: (56) Recv failure: Connection reset by peer

任何人都可以帮忙吗?这与我运行 docker 时需要 sudo 有关吗?

感谢您的时间和关注。

4

2 回答 2

1

在https://github.com/dbpedia-spotlight/spotlight-docker/blob/master/v1.0/english/Dockerfile检查 Spotlight 的 Dockerfile ,它没有配置入口点。

请在您的 docker 命令末尾添加 Spotlight.sh,例如:

docker run -d -p 2222:80 dbpedia/spotlight-english Spotlight.sh

此外,也许您想使用 -d 参数而不是交互模式 -i 将其作为服务运行。

祝一切顺利,

于 2020-04-24T06:44:02.430 回答
1

感谢 Sandro 指出spotlight.sh在运行 docker 时需要运行以及非常有用的-d标志,但是使 docker 工作并停止返回 curl 错误 56 的是此处--restart unless-stopped根据需要指示的标志

为我运行这项工作:

sudo docker run -itd --restart unless-stopped -p 2222:80 dbpedia/spotlight-english spotlight.sh

显然,如果该标志关闭,泊坞窗就会关闭。我个人没有在 ubuntu 18.04 上观察到这种行为,我是通过 ssh 运行它,但是当我决定在 mac 机器上本地安装 docker 时,图像不会保持运行超过一分钟。添加此标志使聚光灯请求在两种环境中都有效。

希望这可以帮助其他面临同样问题的人。

于 2020-04-25T15:24:56.983 回答