[Bug] Problem with deploying Immich using podman-compose #120

Closed
opened 2026-02-04 17:49:01 +03:00 by OVERLORD · 21 comments
Owner

Originally created by @bertmelis on GitHub (Jun 29, 2022).

After launching Immich using podman-compose, containers are started but as soon as I try to access the webpage, (at least) the web container exits because of Error: listen EADDRINUSE: address already in use 0.0.0.0:3000

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use 0.0.0.0:3000
    at Server.setupListenHandle [as _listen2] (node:net:1372:16)
    at listenInCluster (node:net:1420:12)
    at doListen (node:net:1559:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1399:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 3000
}

podman-compose.yml:

version: "3.8"

services:
  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  immich-server:
    image: altran1502/immich-server:latest
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      #- database
    #restart: always

  immich-microservices:
    image: altran1502/immich-server:latest
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis

    immich-web:
    image: altran1502/immich-web:latest
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - .env

  nginx:
    container_name: proxy_nginx
    image: nginx:latest
    volumes:
      - ./settings/nginx-conf:/etc/nginx/conf.d
    ports:
      - 2283:80
      - 2284:443
    logging:
      driver: none
    depends_on:
      - immich-server

.env

###################################################################################
# Database
###################################################################################
DB_HOSTNAME=<redacted
DB_USERNAME=<redacted>
DB_PASSWORD=<redacted>
DB_DATABASE_NAME=immich

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

REDIS_HOSTNAME=immich_redis

###################################################################################
# Upload File Config
###################################################################################
UPLOAD_LOCATION=/mnt/data/photos

###################################################################################
# JWT SECRET
###################################################################################
JWT_SECRET=<redacted>

###################################################################################
# MAPBOX
####################################################################################
# ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY
ENABLE_MAPBOX=false
MAPBOX_KEY=

###################################################################################
# WEB
###################################################################################
# This is the URL of your vm/server where you host Immich, so that the web frontend
# know where can it make the request to.
# For example: If your server IP address is 10.1.11.50, the environment variable will
# be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283/api
VITE_SERVER_ENDPOINT=http://<local ip>:2283/api

sudo netstat -pna | grep 3000 shows no other open ports

I'm trying to set up Immich on Rocky Linux (RHEL) with Podman. I use an external database.

Originally created by @bertmelis on GitHub (Jun 29, 2022). After launching Immich using podman-compose, containers are started but as soon as I try to access the webpage, (at least) the web container exits because of `Error: listen EADDRINUSE: address already in use 0.0.0.0:3000` ``` node:events:505 throw er; // Unhandled 'error' event ^ Error: listen EADDRINUSE: address already in use 0.0.0.0:3000 at Server.setupListenHandle [as _listen2] (node:net:1372:16) at listenInCluster (node:net:1420:12) at doListen (node:net:1559:7) at processTicksAndRejections (node:internal/process/task_queues:84:21) Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1399:8) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'EADDRINUSE', errno: -98, syscall: 'listen', address: '0.0.0.0', port: 3000 } ``` podman-compose.yml: ``` version: "3.8" services: redis: container_name: immich_redis image: redis:6.2 restart: always immich-server: image: altran1502/immich-server:latest entrypoint: ["/bin/sh", "./start-server.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - redis #- database #restart: always immich-microservices: image: altran1502/immich-server:latest entrypoint: ["/bin/sh", "./start-microservices.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload env_file: - .env environment: - NODE_ENV=production depends_on: - redis immich-web: image: altran1502/immich-web:latest entrypoint: ["/bin/sh", "./entrypoint.sh"] env_file: - .env nginx: container_name: proxy_nginx image: nginx:latest volumes: - ./settings/nginx-conf:/etc/nginx/conf.d ports: - 2283:80 - 2284:443 logging: driver: none depends_on: - immich-server ``` .env ``` ################################################################################### # Database ################################################################################### DB_HOSTNAME=<redacted DB_USERNAME=<redacted> DB_PASSWORD=<redacted> DB_DATABASE_NAME=immich ################################################################################### # Redis ################################################################################### REDIS_HOSTNAME=immich_redis ################################################################################### # Upload File Config ################################################################################### UPLOAD_LOCATION=/mnt/data/photos ################################################################################### # JWT SECRET ################################################################################### JWT_SECRET=<redacted> ################################################################################### # MAPBOX #################################################################################### # ENABLE_MAPBOX is either true of false -> if true, you have to provide MAPBOX_KEY ENABLE_MAPBOX=false MAPBOX_KEY= ################################################################################### # WEB ################################################################################### # This is the URL of your vm/server where you host Immich, so that the web frontend # know where can it make the request to. # For example: If your server IP address is 10.1.11.50, the environment variable will # be VITE_SERVER_ENDPOINT=http://10.1.11.50:2283/api VITE_SERVER_ENDPOINT=http://<local ip>:2283/api ``` `sudo netstat -pna | grep 3000` shows no other open ports I'm trying to set up Immich on Rocky Linux (RHEL) with Podman. I use an external database.
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

immich_immich-server_1 exits after a few moments:

[Nest] 29  - 06/29/2022, 3:07:59 PM   ERROR [NestApplication] Error: listen EADDRINUSE: address already in use :::3000 +5ms
Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (node:net:1372:16)
    at listenInCluster (node:net:1420:12)
    at Server.listen (node:net:1508:7)
    at ExpressAdapter.listen (/usr/src/app/node_modules/@nestjs/platform-express/adapters/express-adapter.js:57:32)
    at /usr/src/app/node_modules/@nestjs/core/nest-application.js:167:30
    at new Promise (<anonymous>)
    at NestApplication.listen (/usr/src/app/node_modules/@nestjs/core/nest-application.js:156:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at bootstrap (/usr/src/app/apps/immich/src/main.ts:18:3)

and still when running netsat -pna | grep 3000 there seem to be no open ports on 3000.

@bertmelis commented on GitHub (Jun 29, 2022): immich_immich-server_1 exits after a few moments: ``` [Nest] 29 - 06/29/2022, 3:07:59 PM ERROR [NestApplication] Error: listen EADDRINUSE: address already in use :::3000 +5ms Error: listen EADDRINUSE: address already in use :::3000 at Server.setupListenHandle [as _listen2] (node:net:1372:16) at listenInCluster (node:net:1420:12) at Server.listen (node:net:1508:7) at ExpressAdapter.listen (/usr/src/app/node_modules/@nestjs/platform-express/adapters/express-adapter.js:57:32) at /usr/src/app/node_modules/@nestjs/core/nest-application.js:167:30 at new Promise (<anonymous>) at NestApplication.listen (/usr/src/app/node_modules/@nestjs/core/nest-application.js:156:16) at processTicksAndRejections (node:internal/process/task_queues:96:5) at bootstrap (/usr/src/app/apps/immich/src/main.ts:18:3) ``` and still when running `netsat -pna | grep 3000` there seem to be no open ports on 3000.
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

Podman might work a bit different then Docker here. I'm still on my first steps into Podman but I as I understand all containers in a pod share the same network and port space. So they can't use the same port.

I don't know if this is easily configurable but is surely makes Immich Podman-compatible.

@bertmelis commented on GitHub (Jun 29, 2022): Podman might work a bit different then Docker here. I'm still on my first steps into Podman but I as I understand all containers in a pod share the same network and port space. So they can't use the same port. I don't know if this is easily configurable but is surely makes Immich Podman-compatible.
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

I haven't tested on Podman nor used it before. Is podman-compose similar to docker-compose? If so, if you create a dedicated network, would it work?

@alextran1502 commented on GitHub (Jun 29, 2022): I haven't tested on Podman nor used it before. Is podman-compose similar to docker-compose? If so, if you create a dedicated network, would it work?
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

We can try to troubleshoot by commenting out immich-microservices since it used the same port as the immich-server. In docker-compose, if you don't expose the port, it won't be conflicted, so this might be different with podman

@alextran1502 commented on GitHub (Jun 29, 2022): We can try to troubleshoot by commenting out `immich-microservices` since it used the same port as the `immich-server`. In `docker-compose`, if you don't expose the port, it won't be conflicted, so this might be different with podman
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

I haven't tested on Podman nor used it before. Is podman-compose similar to docker-compose? If so, if you create a dedicated network, would it work?

It uses the same (basic) commands but underlying it uses podman of course. podman-compose up creates the dedicated network, but it is one network for the whole pod. All the containers in the pod use the same port space. Microservices is started first and claims port 3000. Afterwards, nor server nor web can't use that port anymore even though these ports are not exposed outside the pod.

@bertmelis commented on GitHub (Jun 29, 2022): > I haven't tested on Podman nor used it before. Is podman-compose similar to docker-compose? If so, if you create a dedicated network, would it work? It uses the same (basic) commands but underlying it uses podman of course. `podman-compose up` creates the dedicated network, but it is one network for the whole pod. All the containers in the pod use the same port space. Microservices is started first and claims port 3000. Afterwards, nor server nor web can't use that port anymore even though these ports are not exposed outside the pod.
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

I think the conflict here is internally to the pod's network

@alextran1502 commented on GitHub (Jun 29, 2022): I think the conflict here is internally to the pod's network
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

  • podman create network immich_network
  • added network_mode: immich_network to all the containers in the compose-file.

for both microservices and server.

Error: connect ECONNREFUSED 127.0.0.1:6379

PS I might want to move this to discussions...

@bertmelis commented on GitHub (Jun 29, 2022): - `podman create network immich_network` - added `network_mode: immich_network` to all the containers in the compose-file. for both microservices and server. ``` Error: connect ECONNREFUSED 127.0.0.1:6379 ``` PS I might want to move this to discussions...
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

See the last paragraph here: https://www.redhat.com/sysadmin/container-networking-podman

If you put all the containers in a pod (by doing podman-compose) all the containers in the pod can communicate using localhost. This obviously means port space is shared.

Is it worth considering using different ports for the microservices, server and web? (you only need to change two of course)
If not, I'll find another way.

@bertmelis commented on GitHub (Jun 29, 2022): See the last paragraph here: https://www.redhat.com/sysadmin/container-networking-podman If you put all the containers in a pod (by doing podman-compose) all the containers in the pod can communicate using `localhost`. This obviously means port space is shared. Is it worth considering using different ports for the microservices, server and web? (you only need to change two of course) If not, I'll find another way.
Author
Owner

@zackpollard commented on GitHub (Jun 29, 2022):

If all we need to do is change the default ports for the servers then i'm not against that, it's a shame that podman doesn't work similarly to docker here as there is no need to have all the containers running on the same IP (which is presumably what's happening here). Is there no alternative way to set this up in podman so each container gets its own IP and they can communicate with internal dns, like what happens with docker?

@zackpollard commented on GitHub (Jun 29, 2022): If all we need to do is change the default ports for the servers then i'm not against that, it's a shame that podman doesn't work similarly to docker here as there is no need to have all the containers running on the same IP (which is presumably what's happening here). Is there no alternative way to set this up in podman so each container gets its own IP and they can communicate with internal dns, like what happens with docker?
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

It is possible, but not if you're rootless. I'm still looking for a workaround though.

@bertmelis commented on GitHub (Jun 29, 2022): It is possible, but [not if you're rootless](https://github.com/containers/podman/blob/main/docs/tutorials/basic_networking.md#differences-between-rootful-and-rootless-container-networking). I'm still looking for a workaround though.
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

If you cannot find a way to work around it, let us know and we will consider changing the port of those containers.

@alextran1502 commented on GitHub (Jun 29, 2022): If you cannot find a way to work around it, let us know and we will consider changing the port of those containers.
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

I haven't found any clean solutions yet except by creating an abundance of networks.

It would be much cleaner if the ports changed. But before committing this, can I test this myself?

And if it works, can I persuade you with a few 'buy-me-a-coffees'?

@bertmelis commented on GitHub (Jun 29, 2022): I haven't found any clean solutions yet except by creating an abundance of networks. It would be much cleaner if the ports changed. But before committing this, can I test this myself? And if it works, can I persuade you with a few 'buy-me-a-coffees'?
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

Let me build an image with different port and I will write up an instruction of how to test

@alextran1502 commented on GitHub (Jun 29, 2022): Let me build an image with different port and I will write up an instruction of how to test
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

Ok, so I've just changed the port on immich-server to 3001 and immich-microservices to 3002.

It is building in this PR #278

Once you see the check mark is green in the checks section it means that the build is done.

All you have to do on your side is to change the tags of those images to staging i.e altran1502/immich-server:staging and use this Nginx conf file to replace the one in the main repo.


map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

# events {
#   worker_connections 1000;
# }

server {

  gzip on;
  gzip_min_length 1000;
  gunzip on;

  client_max_body_size 50000M;

  listen 80;
  access_log off;

  location /api {

    # Compression
    gzip_static on;
    gzip_min_length 1000;
    gzip_comp_level 2;

    proxy_buffering off;
    proxy_buffer_size 16k;
    proxy_busy_buffers_size 24k;
    proxy_buffers 64 4k;
    proxy_force_ranges on;

    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;

    rewrite /api/(.*) /$1 break;

    proxy_pass http://immich-server:3001;
  }

  location / {

    # Compression
    gzip_static on;
    gzip_min_length 1000;
    gzip_comp_level 2;

    proxy_buffering off;
    proxy_buffer_size 16k;
    proxy_busy_buffers_size 24k;
    proxy_buffers 64 4k;
    proxy_force_ranges on;

    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;

    proxy_pass http://immich-web:3000;
  }
}

Let me know how it goes.

@alextran1502 commented on GitHub (Jun 29, 2022): Ok, so I've just changed the port on `immich-server` to `3001` and `immich-microservices` to `3002`. It is building in this PR #278 Once you see the check mark is green in the checks section it means that the build is done. All you have to do on your side is to change the tags of those images to `staging` i.e `altran1502/immich-server:staging` and use this Nginx conf file to replace the one in the main repo. ```nginx map $http_upgrade $connection_upgrade { default upgrade; '' close; } # events { # worker_connections 1000; # } server { gzip on; gzip_min_length 1000; gunzip on; client_max_body_size 50000M; listen 80; access_log off; location /api { # Compression gzip_static on; gzip_min_length 1000; gzip_comp_level 2; proxy_buffering off; proxy_buffer_size 16k; proxy_busy_buffers_size 24k; proxy_buffers 64 4k; proxy_force_ranges on; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; rewrite /api/(.*) /$1 break; proxy_pass http://immich-server:3001; } location / { # Compression gzip_static on; gzip_min_length 1000; gzip_comp_level 2; proxy_buffering off; proxy_buffer_size 16k; proxy_busy_buffers_size 24k; proxy_buffers 64 4k; proxy_force_ranges on; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_pass http://immich-web:3000; } } ``` Let me know how it goes.
Author
Owner

@bertmelis commented on GitHub (Jun 29, 2022):

Works! You're the man!

One thing I had to change though. I specified a custom redis.conf file and commented out bind 127.0.0.1 -::1.

On container-compose.yml:

  redis:
    container_name: immich_redis
    image: redis:6.2
    volumes:
      -  ./settings/redis:/usr/local/etc/redis:Z
    restart: always

(ref: https://stackoverflow.com/questions/50559985/unable-to-connect-to-redis-from-another-docker-container)

PS There seem to be some problems between Paypal and Github. As soon as they are solved, coffees will be sent!

@bertmelis commented on GitHub (Jun 29, 2022): Works! You're the man! One thing I had to change though. I specified a custom `redis.conf` file and commented out `bind 127.0.0.1 -::1`. On container-compose.yml: ``` redis: container_name: immich_redis image: redis:6.2 volumes: - ./settings/redis:/usr/local/etc/redis:Z restart: always ``` (ref: https://stackoverflow.com/questions/50559985/unable-to-connect-to-redis-from-another-docker-container) PS There seem to be some problems between Paypal and Github. As soon as they are solved, coffees will be sent!
Author
Owner

@alextran1502 commented on GitHub (Jun 29, 2022):

No problem, take your time. I've had my doses for today so tomorrow is fine 😄

I will work with the team on a simplified setup to address this issue. Probably this will be pushed out in the next release or so.

Note that the staging tag will be overridden by other PR if they are pushed so just FYI to keep in mind 😛

@alextran1502 commented on GitHub (Jun 29, 2022): No problem, take your time. I've had my doses for today so tomorrow is fine 😄 I will work with the team on a simplified setup to address this issue. Probably this will be pushed out in the next release or so. Note that the `staging` tag will be overridden by other PR if they are pushed so just FYI to keep in mind 😛
Author
Owner

@bertmelis commented on GitHub (Jun 30, 2022):

No problem, take your time. I've had my doses for today so tomorrow is fine 😄

I will work with the team on a simplified setup to address this issue. Probably this will be pushed out in the next release or so.

Note that the staging tag will be overridden by other PR if they are pushed so just FYI to keep in mind 😛

No problem. I'll guard my images. The Redis issue isn't a problem. Keep up the good work!

@bertmelis commented on GitHub (Jun 30, 2022): > No problem, take your time. I've had my doses for today so tomorrow is fine 😄 > > I will work with the team on a simplified setup to address this issue. Probably this will be pushed out in the next release or so. > > Note that the `staging` tag will be overridden by other PR if they are pushed so just FYI to keep in mind 😛 No problem. I'll guard my images. The Redis issue isn't a problem. Keep up the good work!
Author
Owner

@alextran1502 commented on GitHub (Jun 30, 2022):

@bertmelis The new release v1.15.0 will include the support for podman. Please update your docker-compose file accordingly 😄

Please find the formal release note here https://github.com/alextran1502/immich/releases/tag/v1.15.0_21-dev

@alextran1502 commented on GitHub (Jun 30, 2022): @bertmelis The new release `v1.15.0` will include the support for podman. Please update your docker-compose file accordingly 😄 Please find the formal release note here https://github.com/alextran1502/immich/releases/tag/v1.15.0_21-dev
Author
Owner

@bertmelis commented on GitHub (Jul 1, 2022):

I just realized, I commented out the machine learning container as my old J4105 processor doesn't support AVX. But that services also uses port 3001. I obviously can't test this but I suspect this will also conflict.

@bertmelis commented on GitHub (Jul 1, 2022): I just realized, I commented out the machine learning container as my old J4105 processor doesn't support AVX. But that services also uses port 3001. I obviously can't test this but I suspect this will also conflict.
Author
Owner

@alextran1502 commented on GitHub (Jul 1, 2022):

I think so, can you help me open an issue to change that port? I will have
it included in the next release

On Fri, Jul 1, 2022 at 8:53 AM Bert Melis @.***> wrote:

I just realized, I commended out the machine learning container as my old
J4105 processor doesn't support AVX. But that services also uses port 3001.
I obviously can't test this but I suspect this will also conflict.


Reply to this email directly, view it on GitHub
https://github.com/alextran1502/immich/issues/277#issuecomment-1172374475,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AGONL7QH53SB63YSQMG2DLTVR3Z7HANCNFSM52GC57PA
.
You are receiving this because you modified the open/close state.Message
ID: @.***>

@alextran1502 commented on GitHub (Jul 1, 2022): I think so, can you help me open an issue to change that port? I will have it included in the next release On Fri, Jul 1, 2022 at 8:53 AM Bert Melis ***@***.***> wrote: > I just realized, I commended out the machine learning container as my old > J4105 processor doesn't support AVX. But that services also uses port 3001. > I obviously can't test this but I suspect this will also conflict. > > — > Reply to this email directly, view it on GitHub > <https://github.com/alextran1502/immich/issues/277#issuecomment-1172374475>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AGONL7QH53SB63YSQMG2DLTVR3Z7HANCNFSM52GC57PA> > . > You are receiving this because you modified the open/close state.Message > ID: ***@***.***> >
Author
Owner

@bertmelis commented on GitHub (Jul 1, 2022):

ref: #289

@bertmelis commented on GitHub (Jul 1, 2022): ref: #289
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#120