I am sorry to hear you’re having trouble. Can you confirm how to reproduce your problem please? For example, which command are you using to run n8n? How does your docker compose config file look like, if applicable?
[+] Running 3/2
⠿ Network n8n_default Created 0.2s
⠿ Container n8n-postgres-1 Created 0.1s
⠿ Container n8n-n8n-1 Created 0.1s
Attaching to n8n-n8n-1, n8n-postgres-1
n8n-postgres-1 |
n8n-postgres-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
n8n-postgres-1 |
n8n-postgres-1 | 2023-01-26 09:10:21.151 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
n8n-postgres-1 | 2023-01-26 09:10:21.152 UTC [1] LOG: listening on IPv6 address "::", port 5432
n8n-postgres-1 | 2023-01-26 09:10:21.156 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
n8n-postgres-1 | 2023-01-26 09:10:21.179 UTC [25] LOG: database system was interrupted; last known up at 2023-01-26 09:09:13 UTC
n8n-postgres-1 | 2023-01-26 09:10:21.536 UTC [25] LOG: database system was not properly shut down; automatic recovery in progress
n8n-postgres-1 | 2023-01-26 09:10:21.541 UTC [25] LOG: redo starts at 0/1652C80
n8n-postgres-1 | 2023-01-26 09:10:21.542 UTC [25] LOG: invalid record length at 0/1652CB8: wanted 24, got 0
n8n-postgres-1 | 2023-01-26 09:10:21.542 UTC [25] LOG: redo done at 0/1652C80
n8n-postgres-1 | 2023-01-26 09:10:21.567 UTC [1] LOG: database system is ready to accept connections
n8n-n8n-1 | Initializing n8n process
n8n-n8n-1 | Last session crashed
n8n-n8n-1 exited with code 1
n8n-n8n-1 | Initializing n8n process
n8n-n8n-1 | Last session crashed
n8n-n8n-1 exited with code 1
n8n-n8n-1 | Initializing n8n process
n8n-n8n-1 | Last session crashed
n8n-n8n-1 exited with code 1
It looks like it is a network issue, Try changing the port for n8n to use to connect to the database to 5432 it is all happening in the same network so the host port isn’t available on the container itself it is just a redirect.
I have a different docker instance already running on 5678 (another project is using it). I wanted n8n to be in a different port. Is there a way to do it?
The port of n8n can be changed on the docker host but your issue doesn’t appear to be related to that, If you wanted n8n to listen on a different port on your host though you would need to change
ports:
- 5678:5678
to something like the below which will have the host listening on 8080 for the connections and passing them to 5678 which is an open port in the container.