N8n starter kit on Docker shows missing Postgres environment variables (.env file not found)

I am setting up the starter kit for self-hosting n8n on my Mac Mini (M4). When I try to run it with Docker, I get repeated warnings about missing environment variables. I’m not sure what values I need to set or where to put them, since I don’t see a .env**

What is the error message (if any)?**

WARN[0000] The "POSTGRES_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "POSTGRES_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] The "POSTGRES_DB" variable is not set. Defaulting to a blank string.

Please share your workflow
N/A — I wasn’t able to create a workflow yet since I can’t get the starter kit running.

Share the output returned by the last node
N/A


Information on your n8n setup

  • n8n version: Starter kit (fresh clone from GitHub)

  • Database (default: SQLite): Not sure — the starter kit seems to use Postgres

  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default

  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker

  • Operating system: macOS (Mac Mini M4)

Hey @John_Cedrick welcome to our community!!

You should set these environment variables! Did you use a manual installation or Docker option?

Happy to read your comments!!

I used the Docker option and followed the instructions. I’m at a loss on how to fix this issue since I have no coding knowledge.

Did you tried these comands:

docker volume create n8n_data

docker run -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e GENERIC_TIMEZONE="<YOUR_TIMEZONE>" \
 -e TZ="<YOUR_TIMEZONE>" \
 -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
 -e N8N_RUNNERS_ENABLED=true \
 -e DB_TYPE=postgresdb \
 -e DB_POSTGRESDB_DATABASE=n8n \
 -e DB_POSTGRESDB_HOST=localhost \
 -e DB_POSTGRESDB_PORT=5678 \
 -e DB_POSTGRESDB_USER=your_user \
 -e DB_POSTGRESDB_PASSWORD=your_password \
 -v n8n_data:/home/node/.n8n \
 docker.n8n.io/n8nio/n8n

Reference:

Way better if you are using docker compose instead of Docker itself

How exactly do I do that?

Docker Compose | n8n Docs

You can follow the instructions from given link and manage your env configurations inside the compose file.
It way simpler for organizing and maintaining your configurations instead of using Docker itself.

1 Like

Hey @John_Cedrick! Hope you are doing great! Just to mention that if a comment provided above solved your problem please mark it as solution in order to help others in case face the same issue!

Thanks in advance!:folded_hands:

Hello,

Did you skip this? ‘ cp .env.example .env # you should update secrets and passwords inside ‘
I had this issue as well because i skip that.

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