Docker Container Crashes and quite

I’m VERY new to Docker and i’m trying to start using postgreSQL instead of sql lite. I’m fine with defaults and everything works great.

When I try running with postgress db. The container shows up for a few seconds the drops and I get
last session crashed.

If I could even get pointed to step by steps others have used for beginners that would be great. I’ve been using the n8n docs, but apparently missing something.

docker run -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e N8N_BASIC_AUTH_ACTIVE="true" \
 -e N8N_BASIC_AUTH_USER="philipwiggins" \
 -e N8N_BASIC_AUTH_PASSWORD="myothersecretpassword" \
 -e N8N_HOST="" \
 -e DB_TYPE="postgresdb" \
 -e DB_POSTGRESDB_HOST="localhost" \
 -e DB_POSTGRESDB_USER="n8nAdmin" \
 -e DB_POSTGRESDB_PASSWORD="mysecretpassword" \
 -v ~/.n8n:/home/node/.n8n n8nio/n8n:latest n8n start --tunnel

Information on your n8n setup

  • **n8n version:277.1
  • Database (postgres):
  • Running n8n via (Docker):
  • **Operating system:mac

What n8n version do you use? The one you mentioned does not exist.

Can you please post the output of the n8n container. That will potentially help to debug that problem.

I would also remove the tunnel option, I suspect the issue will be with the database connection. If you remove the Postgres settings and start the container if it says up we know that is where the issue is.

Sorry its 227.1. I will try to get the container output this week when I get a chance to look into again. Are there any good step by step on the postgres sql to get the fields required to connect n8n to it? I’m guess my biggest question is to ensure that i’ve structured the parameters correctly on the docker start.

I’m now on 228.2. I’m able to connect to the postgres db from different systems pgAdmin4 and TablePlus. Both can connect just fine with these creditials, but if I try to connect in any way from n8n it runs and the stops. I’ve tried changing the local host to and even the ip address.

Hey @Philip_Wiggins,

localhost will only work if your database is running in the same container as n8n, Try changing the host to and see if that helps (assuming it is also in a container)


Wow. I’ve been working on this forever and didn’t think about that this got it!!! Thanks!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.