I'm trying to set a local dbpedia spotlight server with the docker image by calling:
sudo docker run -i -p 2222:80 dbpedia/spotlight-english spotlight.sh
the image runs and I get this when prompting 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
but when I send a simple request as:
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
or even one with a header set:
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"
I get the same error:
curl: (56) Recv failure: Connection reset by peer
Can anyone help? Is this related to the need for sudo when I run docker?
Thank you for you time and attention.
Thanks to Sandro for pointing out the need to run spotlight.sh
when running the docker and also for the very useful -d
flag, but what made the docker work and stop returning the curl error 56 was the --restart unless-stopped
flag indicated as needed here
Running this work for me:
sudo docker run -itd --restart unless-stopped -p 2222:80 dbpedia/spotlight-english spotlight.sh
Apparently, if that flag is off, the docker goes down. I've personally haven't observed that behavior on the ubuntu 18.04 I was running this through ssh, but when I've decided to install the docker locally on a mac machine, the image wouldn't stay running for longer than a minute. Adding this flag made the spotlight requests work on both environments.
Hope this helps someone else facing the same problem.