Curl error 52: Empty reply from server when trying to annotate with dbpedia spotlight docker

Ok the solution is building the image locally. Since I am a noob when it comes to dockers this took me a while.
For the future interested reader that made the horrible decision of getting a MacBook Pro with M1 chip, here is the solution:

  1. Make a dockerfile that looks like this:

     FROM --platform=linux/arm64/v8 ubuntu:21.04
     MAINTAINER  DBpedia Spotlight Team <dbp-spotlight-developers@lists.sourceforge.net>
    
     ENV SPOTLIGHT  https://sourceforge.net/projects/spotlight-multilingual-docker/files/dbpedia-spotlight-1.1.jar
    
     # adding required packages
     RUN apt update && apt upgrade -y && \
         apt install -y bash && apt install -y openjdk-8-jre && \
         apt install -y tshark && apt install -y wget && \
         apt install -y curl && apt clean
    
     # downloading spolight model and dbpedia spotlight
     RUN mkdir -p /opt/spotlight/models && \
        cd /opt/spotlight && \
        wget -O dbpedia-spotlight.jar $SPOTLIGHT && \
        mkdir -p src/main/resources/templates/
    
     # adding the script to the container
     ADD spotlight.sh /bin/spotlight.sh
     COPY nif-21.vm /opt/spotlight/src/main/resources/templates/nif-21.vm
     RUN chmod +x /bin/spotlight.sh
    
     EXPOSE 80
    

    I could not manage for the life of me to make it run with the pretty outdated FROM openjdk:8-jre-alpine call (I am referring to the github-dockerfile) . I think this is used because it is smaller but anyway.
    If we do this we need to update all apk commands to apt. I am not sure if apt install -y openjdk-8-jre is needed but I can’t be asked to test this any further 🥲
    The rest stays the same.

  2. We call the docker build:

    docker build -t dbpedia-spotlight-local --platform linux/amd64 .
    

I am quite sure that --platform linux/amd64 is needed. Better be save than sorry.

  1. Finally run the docker:
    Swap the language of your choosing and add --platform linux/amd64 one last time. @JulioNoe has missed that in a previous comment.

     docker run -tid --platform linux/amd64 --restart unless-stopped --name dbpedia-spotlight.lt --mount     source=models,target=/opt/spotlight -p 2222:80 dbpedia-spotlight-local spotlight.sh lt
    

Swap the language of your choosing and add --platform linux/amd64 one last time. @JulioNoe has missed that in a previous comment.

And finally, you can make curl-requests to the server and get a response.

@JulioNoe Thanks again for the help. If I might add: Docker have multi-arch support. Maybe dbpedia considers releasing a newer version of the image to have better support for all systems and to avoid future problems? Shouldn’t take too long for someone who knows what he is doing (not me :upside_down_face:).