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

When going into the CLI I notice that java -version does not do anything. The cursor just blinks. Maybe that’s a hint?

Hi @mingaflo,

Maybe the doc “Docker Desktop for Apple silicon” helps. Also, in this Stackoverflow question I found some interesting solutions but I am not sure how accurate they are since I do not have a Mac OS. Sorry, please if you find any solution, I will appreciate if you can post it for future references. Thanks.

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:).

1 Like

Hi @mingaflo,

I appreciate your solution a lot. I take note of your steps for future reference and for the next releases. Thanks again, have a great day.

My best regards

Julio

1 Like

@JulioNoe @mingaflo I had the same problem today and was able to get a local docker build running on M1 thanks to @mingaflo instructions, however, Spotlight throws these warnings:

WARNING: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS

does it matter? anyway to fix?

Hi,

I had to the version of ubuntu to 22.04 to get it running on my M1.

    FROM --platform=linux/arm64/v8 ubuntu:22.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
1 Like