[BUG] Immich-Server with Podman using ::1 #968

Closed
opened 2026-02-04 23:44:33 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @Tandokude on GitHub (Jun 19, 2023).

The bug

So I am running Immich in a Podman pod, only issue I am coming across is when I use "localhost" for the Typesense Host environment variable. You can see in the Immich-Server logs it tries to connect with error Request to Node 0 failed due to "ECONNREFUSED connect ECONNREFUSED ::1:8108" . This is currently fixed by specifying 127.0.0.1 as the host, however not sure if this is a bug that it's translating localhost to the IPv6 address instead of the IPv4?

The OS that Immich Server is running on

Debian 12 Bookworm

Version of Immich Server

v1.61.0

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

Not using Compose, but this is my build script
#!/bin/bash
# immich-pod.sh

POD="immich"
SERVICE="pod-immich"
DB_ENV="/home/$USER/podman/immich/env/postgres.env"
APP_ENV="/home/$USER/podman/immich/env/immich.env"
RELEASE="v1.61.0"

#set -e

# Build Pod only needed if complete rebuild
rm /run/user/1000/$SERVICE.service-pod-id

podman pod create --name $POD \
--pod-id-file=/run/user/1000/$SERVICE.service-pod-id \
-p 3016:8080 \
--replace \
--infra \
--infra-conmon-pidfile=/run/user/1000/$SERVICE.service-pid \
--infra-name $POD-infra

# Build Database

podman image pull docker.io/library/postgres:14-bullseye
rm /run/user/1000/container-immich-db.service-cid

podman create --name immich-db --replace \
--pod $POD \
--env-file=$DB_ENV \
-v /home/$USER/podman/immich/pgdata:/var/lib/postgresql/data:Z \
--conmon-pidfile /run/user/1000/container-immich-db.service-cpid \
--cidfile /run/user/1000/container-immich-db.service-cid \
--pidfile /run/user/1000/container-immich-db.service-pid \
docker.io/library/postgres:14-bullseye

# Build broker

podman image pull docker.io/library/redis:6.2
rm /run/user/1000/container-immich-broker.service-cid

podman create --name immich-broker --replace \
--pod $POD \
--conmon-pidfile /run/user/1000/container-immich-broker.service-cpid \
--cidfile /run/user/1000/container-immich-broker.service-cid \
--pidfile /run/user/1000/container-immich-broker.service-pid \
docker.io/library/redis:6.2

# Build Proxy

podman image pull ghcr.io/immich-app/immich-proxy:$RELEASE
rm /run/user/1000/container-immich-proxy.service-cid

podman create --name immich-proxy --replace \
--pod $POD \
--env-file=$APP_ENV \
--env IMMICH_SERVER_URL=http://localhost:3001 \
--env IMMICH_WEB_URL=http://localhost:3000 \
--conmon-pidfile /run/user/1000/container-immich-proxy.service-cpid \
--cidfile /run/user/1000/container-immich-proxy.service-cid \
--pidfile /run/user/1000/container-immich-proxy.service-pid \
ghcr.io/immich-app/immich-proxy:release

# Build Typesense

podman image pull docker.io/typesense/typesense:0.24.1
rm /run/user/1000/container-immich-typesense.service-cid

podman create --name immich-typesense --replace \
--pod $POD \
--env TYPESENSE_API_KEY=$APIKEY \
--env TYPESENSE_DATA_DIR=/data \
-v /home/$USER/podman/immich/tsdata:/data:Z \
--conmon-pidfile /run/user/1000/container-immich-typesense.service-cpid \
--cidfile /run/user/1000/container-immich-typesense.service-cid \
--pidfile /run/user/1000/container-immich-typesense.service-pid \
docker.io/typesense/typesense:0.24.1

# Build web

podman image pull ghcr.io/immich-app/immich-web:$RELEASE
rm /run/user/1000/container-immich-web.service-cid

podman create --name immich-web --replace \
--pod $POD \
--env-file=$APP_ENV \
--entrypoint='["/bin/sh","/usr/src/app/entrypoint.sh"]' \
--conmon-pidfile /run/user/1000/container-immich-web.service-cpid \
--cidfile /run/user/1000/container-immich-web.service-cid \
--pidfile /run/user/1000/container-immich-web.service-pid \
ghcr.io/immich-app/immich-web:release

# Build Machine Learning
podman image pull ghcr.io/immich-app/immich-machine-learning:$RELEASE
rm /run/user/1000/container-immich-ml.service-cid

podman create --name immich-machine-learning --replace \
--pod $POD \
--env-file=$APP_ENV \
-v /home/$USER/podman/immich/upload:/usr/src/app/upload \
-v /home/$USER/podman/immich/model-cache:/cache:Z \
--conmon-pidfile /run/user/1000/container-immich-ml.service-cpid \
--cidfile /run/user/1000/container-immich-ml.service-cid \
--pidfile /run/user/1000/container-immich-ml.service-pid \
ghcr.io/immich-app/immich-machine-learning:release

# Build microservices
podman image pull ghcr.io/immich-app/immich-server:$RELEASE
rm /run/user/1000/container-immich-microservices.service-cid

podman create --name immich-microservices --replace \
--pod $POD \
--env-file=$APP_ENV \
-v /home/$USER/podman/immich/upload:/usr/src/app/upload \
--entrypoint='["/bin/sh","./start-microservices.sh"]' \
--conmon-pidfile /run/user/1000/container-immich-microservices.service-cpid \
--cidfile /run/user/1000/container-immich-microservices.service-cid \
--pidfile /run/user/1000/container-immich-microservices.service-pid \
ghcr.io/immich-app/immich-server:release

# Build server
podman image pull ghcr.io/immich-app/immich-server:$RELEASE
rm /run/user/1000/container-immich-server.service-cid

podman create --name immich-server --replace \
--pod $POD \
--env-file=$APP_ENV \
-v /home/$USER/podman/immich/upload:/usr/src/app/upload:Z \
--entrypoint='["/bin/sh","./start-server.sh"]' \
--conmon-pidfile /run/user/1000/container-immich-server.service-cpid \
--cidfile /run/user/1000/container-immich-server.service-cid \
--pidfile /run/user/1000/container-immich-server.service-pid \
ghcr.io/immich-app/immich-server:release

Your .env content

###################################################################################
# Database
###################################################################################

DB_HOSTNAME=localhost
DB_USERNAME=$USERNAME
DB_PASSWORD=$PASSWORD
DB_DATABASE_NAME=$DATABASENAME

# Optional Database settings:
# DB_PORT=5432

###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=localhost

# Optional Redis settings:

# Note: these parameters are not automatically passed to the Redis Container
# to do so, please edit the docker-compose.yml file as well. Redis is not configured
# via environment variables, only redis.conf or the command line

# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=

###################################################################################
# Upload File Location
#
# This is the location where uploaded files are stored.
###################################################################################

UPLOAD_LOCATION=/home/$USER/podman/immich/upload


###################################################################################
# Log message level - [simple|verbose]
###################################################################################

LOG_LEVEL=simple

###################################################################################
# Typesense
###################################################################################
#TYPESENSE_ENABLED=false
TYPESENSE_API_KEY=$KEY
TYPESENSE_HOST=127.0.0.1
#TYPESENSE_PORT=8108
#TYPESENSE_PROTOCOL=http

###################################################################################
# Reverse Geocoding
#
# Reverse geocoding is done locally which has a small impact on memory usage
# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
# This ranges from 0-3 with 3 being the most precise
# 3 - Cities > 500 population: ~200MB RAM
# 2 - Cities > 1000 population: ~150MB RAM
# 1 - Cities > 5000 population: ~80MB RAM
# 0 - Cities > 15000 population: ~40MB RAM
####################################################################################

DISABLE_REVERSE_GEOCODING=false
REVERSE_GEOCODING_PRECISION=3

####################################################################################
# WEB - Optional
#
# Custom message on the login page, should be written in HTML form.
# For example:
# PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
####################################################################################

PUBLIC_LOGIN_PAGE_MESSAGE=""

####################################################################################
# Alternative Service Addresses - Optional
#
# This is an advanced feature for users who may be running their immich services on different hosts.
# It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers.
# Note: immich-microservices is bound to 3002, but no references are made
####################################################################################

IMMICH_WEB_URL=http://localhost:3000
IMMICH_SERVER_URL=http://localhost:3001
IMMICH_MACHINE_LEARNING_URL=http://localhost:3003

####################################################################################
# Alternative API's External Address - Optional
#
# This is an advanced feature used to control the public server endpoint returned to clients during Well-known discovery.
# You should only use this if you want mobile apps to access the immich API over a custom URL. Do not include trailing slash.
# NOTE: At this time, the web app will not be affected by this setting and will continue to use the relative path: /api
# Examples: http://localhost:3001, http://immich-api.example.com, etc
####################################################################################

#IMMICH_API_URL_EXTERNAL=http://localhost:3001
NODE_ENV=production

Reproduction steps

1.run script
2.podman pod start immich
3.podman log immich-server
4.podman ps to see immich-server has died
...

Additional information

No response

Originally created by @Tandokude on GitHub (Jun 19, 2023). ### The bug So I am running Immich in a Podman pod, only issue I am coming across is when I use "localhost" for the Typesense Host environment variable. You can see in the Immich-Server logs it tries to connect with error _Request to Node 0 failed due to "ECONNREFUSED connect ECONNREFUSED ::1:8108"_ . This is currently fixed by specifying 127.0.0.1 as the host, however not sure if this is a bug that it's translating localhost to the IPv6 address instead of the IPv4? ### The OS that Immich Server is running on Debian 12 Bookworm ### Version of Immich Server v1.61.0 ### Version of Immich Mobile App N/A ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML Not using Compose, but this is my build script #!/bin/bash # immich-pod.sh POD="immich" SERVICE="pod-immich" DB_ENV="/home/$USER/podman/immich/env/postgres.env" APP_ENV="/home/$USER/podman/immich/env/immich.env" RELEASE="v1.61.0" #set -e # Build Pod only needed if complete rebuild rm /run/user/1000/$SERVICE.service-pod-id podman pod create --name $POD \ --pod-id-file=/run/user/1000/$SERVICE.service-pod-id \ -p 3016:8080 \ --replace \ --infra \ --infra-conmon-pidfile=/run/user/1000/$SERVICE.service-pid \ --infra-name $POD-infra # Build Database podman image pull docker.io/library/postgres:14-bullseye rm /run/user/1000/container-immich-db.service-cid podman create --name immich-db --replace \ --pod $POD \ --env-file=$DB_ENV \ -v /home/$USER/podman/immich/pgdata:/var/lib/postgresql/data:Z \ --conmon-pidfile /run/user/1000/container-immich-db.service-cpid \ --cidfile /run/user/1000/container-immich-db.service-cid \ --pidfile /run/user/1000/container-immich-db.service-pid \ docker.io/library/postgres:14-bullseye # Build broker podman image pull docker.io/library/redis:6.2 rm /run/user/1000/container-immich-broker.service-cid podman create --name immich-broker --replace \ --pod $POD \ --conmon-pidfile /run/user/1000/container-immich-broker.service-cpid \ --cidfile /run/user/1000/container-immich-broker.service-cid \ --pidfile /run/user/1000/container-immich-broker.service-pid \ docker.io/library/redis:6.2 # Build Proxy podman image pull ghcr.io/immich-app/immich-proxy:$RELEASE rm /run/user/1000/container-immich-proxy.service-cid podman create --name immich-proxy --replace \ --pod $POD \ --env-file=$APP_ENV \ --env IMMICH_SERVER_URL=http://localhost:3001 \ --env IMMICH_WEB_URL=http://localhost:3000 \ --conmon-pidfile /run/user/1000/container-immich-proxy.service-cpid \ --cidfile /run/user/1000/container-immich-proxy.service-cid \ --pidfile /run/user/1000/container-immich-proxy.service-pid \ ghcr.io/immich-app/immich-proxy:release # Build Typesense podman image pull docker.io/typesense/typesense:0.24.1 rm /run/user/1000/container-immich-typesense.service-cid podman create --name immich-typesense --replace \ --pod $POD \ --env TYPESENSE_API_KEY=$APIKEY \ --env TYPESENSE_DATA_DIR=/data \ -v /home/$USER/podman/immich/tsdata:/data:Z \ --conmon-pidfile /run/user/1000/container-immich-typesense.service-cpid \ --cidfile /run/user/1000/container-immich-typesense.service-cid \ --pidfile /run/user/1000/container-immich-typesense.service-pid \ docker.io/typesense/typesense:0.24.1 # Build web podman image pull ghcr.io/immich-app/immich-web:$RELEASE rm /run/user/1000/container-immich-web.service-cid podman create --name immich-web --replace \ --pod $POD \ --env-file=$APP_ENV \ --entrypoint='["/bin/sh","/usr/src/app/entrypoint.sh"]' \ --conmon-pidfile /run/user/1000/container-immich-web.service-cpid \ --cidfile /run/user/1000/container-immich-web.service-cid \ --pidfile /run/user/1000/container-immich-web.service-pid \ ghcr.io/immich-app/immich-web:release # Build Machine Learning podman image pull ghcr.io/immich-app/immich-machine-learning:$RELEASE rm /run/user/1000/container-immich-ml.service-cid podman create --name immich-machine-learning --replace \ --pod $POD \ --env-file=$APP_ENV \ -v /home/$USER/podman/immich/upload:/usr/src/app/upload \ -v /home/$USER/podman/immich/model-cache:/cache:Z \ --conmon-pidfile /run/user/1000/container-immich-ml.service-cpid \ --cidfile /run/user/1000/container-immich-ml.service-cid \ --pidfile /run/user/1000/container-immich-ml.service-pid \ ghcr.io/immich-app/immich-machine-learning:release # Build microservices podman image pull ghcr.io/immich-app/immich-server:$RELEASE rm /run/user/1000/container-immich-microservices.service-cid podman create --name immich-microservices --replace \ --pod $POD \ --env-file=$APP_ENV \ -v /home/$USER/podman/immich/upload:/usr/src/app/upload \ --entrypoint='["/bin/sh","./start-microservices.sh"]' \ --conmon-pidfile /run/user/1000/container-immich-microservices.service-cpid \ --cidfile /run/user/1000/container-immich-microservices.service-cid \ --pidfile /run/user/1000/container-immich-microservices.service-pid \ ghcr.io/immich-app/immich-server:release # Build server podman image pull ghcr.io/immich-app/immich-server:$RELEASE rm /run/user/1000/container-immich-server.service-cid podman create --name immich-server --replace \ --pod $POD \ --env-file=$APP_ENV \ -v /home/$USER/podman/immich/upload:/usr/src/app/upload:Z \ --entrypoint='["/bin/sh","./start-server.sh"]' \ --conmon-pidfile /run/user/1000/container-immich-server.service-cpid \ --cidfile /run/user/1000/container-immich-server.service-cid \ --pidfile /run/user/1000/container-immich-server.service-pid \ ghcr.io/immich-app/immich-server:release ``` ### Your .env content ```Shell ################################################################################### # Database ################################################################################### DB_HOSTNAME=localhost DB_USERNAME=$USERNAME DB_PASSWORD=$PASSWORD DB_DATABASE_NAME=$DATABASENAME # Optional Database settings: # DB_PORT=5432 ################################################################################### # Redis ################################################################################### REDIS_HOSTNAME=localhost # Optional Redis settings: # Note: these parameters are not automatically passed to the Redis Container # to do so, please edit the docker-compose.yml file as well. Redis is not configured # via environment variables, only redis.conf or the command line # REDIS_PORT=6379 # REDIS_DBINDEX=0 # REDIS_PASSWORD= # REDIS_SOCKET= ################################################################################### # Upload File Location # # This is the location where uploaded files are stored. ################################################################################### UPLOAD_LOCATION=/home/$USER/podman/immich/upload ################################################################################### # Log message level - [simple|verbose] ################################################################################### LOG_LEVEL=simple ################################################################################### # Typesense ################################################################################### #TYPESENSE_ENABLED=false TYPESENSE_API_KEY=$KEY TYPESENSE_HOST=127.0.0.1 #TYPESENSE_PORT=8108 #TYPESENSE_PROTOCOL=http ################################################################################### # Reverse Geocoding # # Reverse geocoding is done locally which has a small impact on memory usage # This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable # This ranges from 0-3 with 3 being the most precise # 3 - Cities > 500 population: ~200MB RAM # 2 - Cities > 1000 population: ~150MB RAM # 1 - Cities > 5000 population: ~80MB RAM # 0 - Cities > 15000 population: ~40MB RAM #################################################################################### DISABLE_REVERSE_GEOCODING=false REVERSE_GEOCODING_PRECISION=3 #################################################################################### # WEB - Optional # # Custom message on the login page, should be written in HTML form. # For example: # PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>" #################################################################################### PUBLIC_LOGIN_PAGE_MESSAGE="" #################################################################################### # Alternative Service Addresses - Optional # # This is an advanced feature for users who may be running their immich services on different hosts. # It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers. # Note: immich-microservices is bound to 3002, but no references are made #################################################################################### IMMICH_WEB_URL=http://localhost:3000 IMMICH_SERVER_URL=http://localhost:3001 IMMICH_MACHINE_LEARNING_URL=http://localhost:3003 #################################################################################### # Alternative API's External Address - Optional # # This is an advanced feature used to control the public server endpoint returned to clients during Well-known discovery. # You should only use this if you want mobile apps to access the immich API over a custom URL. Do not include trailing slash. # NOTE: At this time, the web app will not be affected by this setting and will continue to use the relative path: /api # Examples: http://localhost:3001, http://immich-api.example.com, etc #################################################################################### #IMMICH_API_URL_EXTERNAL=http://localhost:3001 NODE_ENV=production ``` ### Reproduction steps ```bash 1.run script 2.podman pod start immich 3.podman log immich-server 4.podman ps to see immich-server has died ... ``` ### Additional information _No response_
Author
Owner

@jrasm91 commented on GitHub (Jun 19, 2023):

There is pretty minimal connection-related code in immich itself for typesense, so even if it was a bug it's most likely an upstream issue not something we'd fix in our code.

@jrasm91 commented on GitHub (Jun 19, 2023): There is pretty minimal connection-related code in immich itself for typesense, so even if it was a bug it's most likely an upstream issue not something we'd fix in our code.
Author
Owner

@schlauerlauer commented on GitHub (Jun 21, 2023):

Yes, localhost should work in podman pods (as described here), but I also have issues with this sometimes.
So I always use 127.0.0.1 in pods as it is more reliable for me.

I believe this is an issue with podman, not immich.

@schlauerlauer commented on GitHub (Jun 21, 2023): Yes, `localhost` *should* work in podman pods (as described [here](https://github.com/containers/podman/blob/main/docs/tutorials/basic_networking.md#communicating-between-containers-and-pods)), but I also have issues with this sometimes. So I always use `127.0.0.1` in pods as it is more reliable for me. I believe this is an issue with podman, not immich.
Author
Owner

@Tandokude commented on GitHub (Jun 21, 2023):

Yes, localhost should work in podman pods (as described here), but I also have issues with this sometimes.

So I always use 127.0.0.1 in pods as it is more reliable for me.

I believe this is an issue with podman, not immich.

I would agree it was a podman issue if it was all 9 containers having the same issue. However even running podman exec immich-proxy curl http://localhost:8108 properly returned 127.0.0.1

@Tandokude commented on GitHub (Jun 21, 2023): > Yes, `localhost` *should* work in podman pods (as described [here](https://github.com/containers/podman/blob/main/docs/tutorials/basic_networking.md#communicating-between-containers-and-pods)), but I also have issues with this sometimes. > > So I always use `127.0.0.1` in pods as it is more reliable for me. > > > > I believe this is an issue with podman, not immich. I would agree it was a podman issue if it was all 9 containers having the same issue. However even running podman exec immich-proxy curl http://localhost:8108 properly returned 127.0.0.1
Author
Owner

@Tandokude commented on GitHub (Jun 21, 2023):

There is pretty minimal connection-related code in immich itself for typesense, so even if it was a bug it's most likely an upstream issue not something we'd fix in our code.

Fair enough, I mostly wanted it documented in case anyone else googled for it like I did with frustrating results.

@Tandokude commented on GitHub (Jun 21, 2023): > There is pretty minimal connection-related code in immich itself for typesense, so even if it was a bug it's most likely an upstream issue not something we'd fix in our code. Fair enough, I mostly wanted it documented in case anyone else googled for it like I did with frustrating results.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#968