server error : connect ECONNREFUSED 172.18.0.7:3001
Running proxmox with nfs share mounted to lxc container with portainer.
Used: https://documentation.immich.app/docs/install/portainer
To install, changed upload location to /mnt/pve/portainer (nfs location)
And database to:
volumes: - ${UPLOAD_LOCATION}/data:/var/lib/postgresql/data
After that I get this error:
connect ECONNREFUSED 172.18.0.7:3001 - ECONNREFUSED
Stacktrace
Error: connect ECONNREFUSED 172.18.0.7:3001
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
All I really want is to use the nfs share for the big data. Maybe I'm doing something wrong but I can't figure out what. Though it's also 5am that doesn't help 🙂
Portainer | Immich
Install Immich using Portainer's Stack feature.
91 Replies
Can you upload you stack configuration and redacted .env?
I'm guessing the server is not starting because of a misconfiguration, you could also look at the immich_server logs
version: "3.8"
services:
immich-server:
container_name: immich_server
image: altran1502/immich-server:release
entrypoint: ["/bin/sh", "./start-server.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- stack.env
environment:
- NODE_ENV=production
depends_on:
- redis
- database
restart: always
immich-microservices:
container_name: immich_microservices
image: altran1502/immich-server:release
entrypoint: ["/bin/sh", "./start-microservices.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- stack.env
environment:
- NODE_ENV=production
depends_on:
- redis
- database
restart: always
immich-machine-learning:
container_name: immich_machine_learning
image: altran1502/immich-machine-learning:release
entrypoint: ["/bin/sh", "./entrypoint.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- stack.env
environment:
- NODE_ENV=production
depends_on:
- database
restart: always
immich-web:
container_name: immich_web
image: altran1502/immich-web:release
entrypoint: ["/bin/sh", "./entrypoint.sh"]
env_file:
- stack.env
restart: always
redis:
container_name: immich_redis
image: redis:6.2
restart: always
database:
container_name: immich_postgres
image: postgres:14
env_file:
- stack.env
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
PG_DATA: /var/lib/postgresql/data
volumes:
- ${UPLOAD_LOCATION}/data:/var/lib/postgresql/data
restart: always

oke it is def my mounted nfs share that doesn't work (but does on host)
Does it work on other containers?
Is this the first time using the volume in docker?
I'm not sure how I can check that? I haven't deployed anything else other then portainer with immich.
It is the first time for this volume yes. But when I go into the container with sh I can create a folder and that works perfectly, I can see it on my nfs share
Which container do you mean? Immich or portainer?
The server container of immich
You can attach to the container and make a new directory in
/usr/src/app/upload
and the new folder shows up in the share?yes exactly!
I don't know if it is a problem but your mounts are kind of messed up
UPLOAD_LOCATION gets mounted to the immich containers and UPLOAD_LOCATION/data is mounted to postgres (so /data will be inside the immich containers too)
Yeah that's kinda ugly, but that shouldn't be a problem right?
I can chance that, I just chance UPLOAD_LOCATION to something else and hardcode the nfs location for database
I'd maybe change upload location to be
/mnt/pvc/Portainer/Immich/upload
and then change the volume mount for postgres to be:
- /mnt/pvc/Portainer/Immich/postgres:/var/lib/postgresql/data
Allright will do that. pvc = pve right?
Probably lol. Whatever your path is/was
haha yeah oke thought so
Can you try restarting the stack without the last three env variables? The IMMICH_WEB/SERVER/MICRO envs should not be needed (and the defaults should work just fine)
Changed it, still error:




The thing that puzzles me is that I can CRUD stuff from the containers in nfs share but when I change location to non nfs it seems to work
Did you already check the logs in immich_server?
Might be worth checking the permissions on the share from inside the container?
I will check the logs again, I didn't see anything but maybe didn't look at the right location. I will look into permissions, have to go right now. Thank you for all your help so far 🙏
seems like I either checked the wrong log or at the wrong time.
postgresql : 2023-01-27 18:55:24.581 UTC [43] FATAL: no pg_hba.conf entry for host "172.21.0.6", user "postgres", database "immich", no encryption
server: [Nest] 1 - 01/27/2023, 6:56:51 PM ERROR [ExceptionHandler] no pg_hba.conf entry for host "172.21.0.7", user "postgres", database "immich", no encryption
error: no pg_hba.conf entry for host "172.21.0.7", user "postgres", database "immich", no encryption
at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:287:98)
at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Hey hey that's an error that makes more sense
You are using the immich provided postgres container right?
yes this error is very usefull!
I am indeed
You know what, we've moved the postgres data location.
Can you stop the stack, delete the postgres data directory and then start it up again?
This is atleast new

Did the imimch-server container come up fine?
Does it need to come up first?
The dependencies are in the stack to if you just shut it down and start it up it should be fine.
But did you check the log and see if the postgres error is still there or if it went away?
I'm having a similar error after upgrading the stack
The same problem here.
immich_server said it fails to connect the database
postgres container said the error below
exec: "/usr/local/bin/docker-entrypoint.sh": stat /usr/local/bin/docker-entrypoint.sh: permission denied
So after being busy I've decided to just purge everything , change nfs permission on host. Mount directly to lxc container. I've just started from scratch and it worked straight away!
I'm pretty sure it was the NFS permissions but I can't say for sure. Hopefully this is stable and I can just start back-up completely of all pictures!
I'm getting the same error after upgrading the stack. No change has been made to the env or the host machine.
Did you disable IPv6?
we enable support for IPv6 and apparently it cause some issues for some people
I dont think i touched IPv6. Where in the docker config do i disable it?

Are you on the latest version? 1.47.2?
Yes

Can you post your
.env
? Please make sure to have DB_HOSTNAME=immich_postgres
in itDB_USERNAME=postgres
DB_PASSWORD=***
DB_DATABASE_NAME=immich
UPLOAD_LOCATION=/mnt/deluge/Partilhas/immich
JWT_SECRET=**
ENABLE_MAPBOX=false
VITE_SERVER_ENDPOINT=http://192.168.1.30:2283/api
DB_HOSTNAME=immich_postgres
does it work now after you include the DB_HOSTNAME and bring down/up the stack again?
Nope, same error with or without
Then something is wrong in your compose file. Where is the ip of 127.0.0.1 coming from?
Hello. I had this issue. I did not think it through and I deleted the images. Is there any db backup I can restore? Because now it is completely clean.
I was working fine for 6 months. Update from 1.45 onwards broke it for some reason. 127.0.0.1 is localhost.
`
version: "3.8"
services:
immich-server:
image: altran1502/immich-server:release
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:release
entrypoint: ["/bin/sh", "./start-microservices.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- .env
environment:
- NODE_ENV=production
depends_on:
- redis
- database
restart: always
immich-machine-learning:
image: altran1502/immich-machine-learning:release
entrypoint: ["/bin/sh", "./entrypoint.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- .env
environment:
- NODE_ENV=production
depends_on:
- database
restart: always
immich-web:
image: altran1502/immich-web:release
entrypoint: ["/bin/sh", "./entrypoint.sh"]
env_file:
- .env
restart: always
redis:
container_name: immich_redis
image: redis:6.2
restart: always
database:
container_name: immich_postgres
image: postgres:14
env_file:
- .env
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
PG_DATA: /var/lib/postgresql/data
volumes:
- pgdata:/var/lib/postgresql/data
restart: always
immich-proxy:
container_name: immich_proxy
image: altran1502/immich-proxy:release
ports:
- 2283:8080
logging:
driver: none
depends_on:
- immich-server
restart: always
volumes:
pgdata:`
Here's the docker-compose code
env file was a few lines back
I even redeployed with all the basic .env and docker-compose files from your wiki keeping only the pgdata and error persistsCan you update your docker-compose file to the latest one?
And also your .env
Thats exactly what i did. Same result.
cant upload the whole thing without discord nitro, ill break in two
ersion: "3.8"
services:
immich-server:
container_name: immich_server
image: altran1502/immich-server:release
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:
container_name: immich_microservices
image: altran1502/immich-server:release
entrypoint: ["/bin/sh", "./start-microservices.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- .env
environment:
- NODE_ENV=production
depends_on:
- redis
- database
restart: always
immich-machine-learning:
container_name: immich_machine_learning
image: altran1502/immich-machine-learning:release
entrypoint: ["/bin/sh", "./entrypoint.sh"]
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
env_file:
- .env
environment:
- NODE_ENV=production
depends_on:
- database
restart: always
immich-web:
container_name: immich_web
image: altran1502/immich-web:release
entrypoint: ["/bin/sh", "./entrypoint.sh"]
env_file:
- .env
restart: always
redis:
container_name: immich_redis
image: redis:6.2
restart: always
database:
container_name: immich_postgres
image: postgres:14
env_file:
- .env
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
PG_DATA: /var/lib/postgresql/data
volumes:
- pgdata:/var/lib/postgresql/data
restart: always
immich-proxy:
container_name: immich_proxy
image: altran1502/immich-proxy:release
environment:
# Make sure these values get passed through from the env file
- IMMICH_SERVER_URL
- IMMICH_WEB_URL
ports:
- 2283:8080
logging:
driver: none
depends_on:
- immich-server
restart: always
volumes:
pgdata:
JWT_SECRET=***
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=***
DB_DATABASE_NAME=immich
REDIS_HOSTNAME=immich_redis
UPLOAD_LOCATION=/mnt/deluge/Partilhas/immich
IMMICH_WEB_URL=http://immich-web:3000
IMMICH_SERVER_URL=http://immich-server:3001
IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
Are you using portainer?
Have you swapped out .env for stack.env?
We require db hostname as an env variable now. You probably aren't setting that correctly.
what else do i need to change? db hostname is the docker container name
everything is default, but since 1.45 it stopped working
i can see i'm not alone with this issue and i really didn't want to delete my database
How are you deploying it? Are you running docker compose up?
Hello guys, I am facing exactly same error message. Docker with portainer, old configuration worked well up to latest update where I have error message attached

btw 172.24.0.6 is the immich_server and not the database not sure if this is or not the same issue as previous users
Can you post your setup?
Thanks Alex, it is pretty the default docker compose yaml, I try to paste here
A screenshot can be helpful as well for portainer setup and the environment variables that you used
here the env configuration

Can you try bring the whole stack down, instead of restart the stack?
then after that, bring them all up
let's try 🙂
Thanks @Alex Tran it did the trick!! sorry to have bothered you with so easy solution, stop and start again!
no problem
I know that docker-compose if you don't bring up and down explicitly, the restart sometimes running into weird state
good to know, maybe we need to add some sequence in starting the containers?
We already have that sequence
oh, depends on already there
My guess here is the immich-proxy doesn't always restart properly
but an up and down put it in good place
using portainer stack
Also facing the same issue here after upgrading to 1.48.1...
Getting this error in de PostgresDB:
2023-02-22 09:30:17.397 UTC [104] ERROR: insert or update on table "smart_info" violates foreign key constraint "FK_5e3753aadd956110bf3ec0244ac"
2023-02-22 09:30:17.397 UTC [104] DETAIL: Key (assetId)=(44a1427b-64ae-431e-860f-4212754b4f94) is not present in table "assets".
2023-02-22 09:30:17.397 UTC [104] STATEMENT: ALTER TABLE "smart_info" ADD CONSTRAINT "FK_5e3753aadd956110bf3ec0244ac" FOREIGN KEY ("assetId") REFERENCES "assets"("id") ON DELETE CASCADE ON UPDATE NO ACTION
anyone know how to fix this one?
@Alex Tran do you have any idea?
what is your setup look like?
Running from the Docker-compose file from the site everything default further
Can you access to the database container?
let's run some query
Yes ....
docker exec -it immich_postgres bash
There I see the the errors
then
psql -U postgres -d immich
let me know when you are inim in
Ok run this query
select * from smart_info si where "assetId" = '44a1427b-64ae-431e-860f-4212754b4f94';

now run
select * from assets a where a.id = '44a1427b-64ae-431e-860f-4212754b4f94';

0 rows
Broken at an upload or so ?
ok now we just need to delete that row in the smart_info table
perhaps
we didin't have proper Foreign key before and this new update enforce it
Ah ok
and then restart your stack again to see if the migration would run succesfully
stopping 🙂
Yeah!
Immich working again
👏
Thanks Alex!
Thanks man, sorry for the hassle
No worries!
bit offtopic I also saw something on a post, that Android should cache the timeline... When I start the app, it always says Building Timeline....
Is that OK?
if there is nothing new, it would reuse the cache value, if you upload new asset to the server, it would refetch the data.
we are working toward an offline solution
so that everything will be cache and Immich works offline
Here is the PR to follow https://github.com/immich-app/immich/pull/1759
ah great!
Thank you again for your project and help... Really love the project!
No problem man! Thank you for diving in 😄