N8n docker on ubuntu 22.04 continuously restarting

Describe the problem/error/question

After the installation on a new server(ubuntu 22.04), the page shows either bad gateway or 404 page not found. When checked with docker ps command, it is restarting continuously.

root@myser:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
04c76d4bfa10 docker.n8n.io/n8nio/n8n “tini – /docker-ent…” 15 minutes ago Restarting (1) 20 seconds ago root-n8n-1
1db9db21a645 traefik “/entrypoint.sh --ap…” 15 minutes ago Up 12 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp root-traefik-1

What is the error message (if any)?

Bad Gateway or 404 page not found

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

are you able to view the logs with: docker logs 04c76d4bfa10 -f before it reboots? (the -f will follow the log I believe even if it reboots).

That should help troubleshoot the issue.

1 Like

Hey @mahesh,

This is likely to be a permission error, Can you try the command below and make sure you replace ~/.n8n with the data_folder value if you are using the env option.

docker run --rm -it --user root -v ~/.n8n:/home/node/.n8n --entrypoint chown n8nio/base:16 -R node:node /home/node/.n8n

I have tried to recreate the setup today and gave the permissions as you mentioned. But still same issue that docker is restarting continuosly.

@NealSr log shows below

Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’
Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’
Error: Exiting due to an error.
Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’
Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’
Error: Exiting due to an error.
Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’
Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’
Error: Exiting due to an error.
Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’

@Jon Executed the permissions command you have mentioned, still same issue.

@Jon There was a typo in my data folder name. It works fine now. Thanks for your help

1 Like

The updated deployment guides will be going live shortly