Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license CC4-BY
posted in category Systems Software / Immich
posted at 18. Oct '24

How To Fix Immich immich_machine_learning connection to (‘192.168.1.0/24’, 3003) failed`

Recently, couple of months ago, I set up an Immich/Github. The instance still have one user and two images, but I’m working on that. In addition I enabled in docker-compose.yml machine learning with cuda. Everything works just fine, except of the machine learning container, which fails by default.

If machine learning container is dead or restarting, photos from an external library won’t show. Why? Does is make sense? Nope. But yes, I want to add photos via Samba, not to upload them via a web interface.

In this article I’ll write about v1.118.2 - https://github.com/immich-app/immich/releases/tag/v1.118.2 released on 2024-10-16.

The error coming from docker logs -f immich-machine-learning is:

immich_machine_learning  | [10/17/24 23:14:26] INFO     Starting gunicorn 23.0.0                           
immich_machine_learning  | [10/17/24 23:14:26] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:27] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:28] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:31] INFO     Starting gunicorn 23.0.0                           
immich_machine_learning  | [10/17/24 23:14:31] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:32] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:33] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:34] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known               
immich_machine_learning  | [10/17/24 23:14:35] ERROR    connection to ('192.168.1.0/24', 3003) failed:     
immich_machine_learning  |                              [Errno -2] Name or service not known 

To be honest, I’m not sure why in my .env there is a line IMMICH_HOST=192.168.1.0/24. I guess I went through this: https://immich.app/docs/install/environment-variables/ and thought it was a good idea, maybe the documentation changed or I did a dumb mistake. According to the current documentation, IMMICH_HOST is by default 0.0.0.0 which is good and means it listens on all interfaces. And the variable is not present in .env by default.

Which is technically not true as the absence of IMMICH_HOST will result in listening on IPv6 version of 0.0.0.0 (all zeroes 0000:....:0000), but the support for IPv6 is everywhere these days, right?

immich_machine_learning  | [10/17/24 23:53:45] INFO     Listening at: http://[::]:3003 (9)
immich_server  | [Nest] 17  - 10/18/2024, 1:53:49 AM     LOG [Api:Bootstrap] Immich Server is listening on http://[::1]:2283 [v1.118.2] [production]

Anyways, the solution is either set it to IMMICH_HOST=0.0.0.0 in .env to avoid IPv6 issues. Or remove it to use [::].

There were discussions about the correct variable name on Github - https://github.com/immich-app/immich/discussions/8220 - MACHINE_LEARNING_HOST vs. IMMICH_HOST. It is really IMMICH_HOST, you can always check the entrypoint of docker container: https://github.com/immich-app/immich/blob/main/machine-learning/start.sh.


: "${IMMICH_HOST:=[::]}"
: "${IMMICH_PORT:=3003}"
: "${MACHINE_LEARNING_WORKERS:=1}"
: "${MACHINE_LEARNING_HTTP_KEEPALIVE_TIMEOUT_S:=2}"

Yeah and that’s all. I think I’ll pin the version of Immich to a certain version as currently my Ansible setup scripts pull a new image everytime I run it and it breaks pretty often.

Add Comment