Accessing web interface / api when using docker on Mac

57 views
Skip to first unread message

Kris De Winter

unread,
May 19, 2023, 9:30:35 AM5/19/23
to Annif Users
Hi,

this is more of a docker-related help request and no issue with Annif, but after unsuccesfully trying several remedies I found on stack overflow etc. I hope someone here might have had the same issue and thus a solution.

Situation: running Annif as docker container on a M1 Macbook. I can run all annif commands inside the container without issues.
However, the web interface and api are not accessible at localhost:5000 as docker on Mac does not support using the host's network.
Port forwarding should work according to this post, but it doesn't work for me.
Next I tried the 'docker-mac-connect' tool but also without success.

So hoping fellow mac-users have already found a way to get this working.

Kris

Jim Hahn

unread,
May 19, 2023, 12:11:17 PM5/19/23
to Annif Users
Hi Kris,

It can run on m1 macs -- if you start the container with the port flag:

docker run -it --rm -p 5000:5000 quay.io/natlibfi/annif bash

(you'll get the warning: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested) but it should be running...

then in the running container's terminal:

annif run -h 0.0.0.0

You should then see the UI by navigating to http://localhost:5000

--
You received this message because you are subscribed to the Google Groups "Annif Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to annif-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/annif-users/d6caf2ed-c4de-4019-8405-7ee53e4899b7n%40googlegroups.com.

Kris De Winter

unread,
May 22, 2023, 4:34:23 AM5/22/23
to Annif Users
Hi Jim,

thanks, it was the -h 0.0.0.0 option I wasn't aware of that was needed. 
It works now, but it's extremely slow compared to running Annif un-containerized and sometimes times out. Any advice on that by chance?
I've got Docker configured to use 4 CPU's, 8GB RAM and and 1GB swap, I'd think that's more than enough and suspect another cause for the slowness.

cheers,
Kris

Op vrijdag 19 mei 2023 om 18:11:17 UTC+2 schreef jimf...@gmail.com:

Jim Hahn

unread,
May 22, 2023, 9:52:39 AM5/22/23
to Kris De Winter, Annif Users
I'm not totally sure. I have observed when I run Annif this way in a container through Docker that the first request (the application is loading the model.data) will take time. Thereafter, it seems OK. From observation of the running app it seems this is being loaded into memory and once in memory the application performs as expected in terms of response time. Of course allocating as much memory to your docker desktop as possible will also help. Beyond that I'm not totally sure what else could be done. Perhaps there are others who have come across the issue you have...

Sincerely,
Jim

Reply all
Reply to author
Forward
0 new messages