Impossible to restart n8n after restarting VPS

Hello,

I have a trouble with n8n on my VPS.
Everythings work good for several months.
I restart my VPS, restart n8n with this command:

sudo docker-compose up -d

But I have this error:

WARNING: The DATA_FOLDER variable is not set. Defaulting to a blank string.
Starting root_n8n_1 ...
Starting root_traefik_1 ...
Starting root_traefik_1 ... error
...

And when I try to access with chrome I have a 404 erreur.

Do you know how to solve it?

Hello @frankl1, what does look your docker-compose.yml?

Hello @Elpatii
This is my docker-compose.yml:

This is the exact error I have:

Hello @frankl1, it seems that you have other containers running and using these ports.
If you list your running/stopped containers (sudo docker ps), do you have something?

I try to stop and restart my docker compose with this commands:

sudo docker-compose stop

then

sudo docker-compose up -d

I have this error:

I try sudo docker ps:

n8n2

Strange, because you see in the CLI that docker-compose add the suffix _1 to each container, like if you have already containers created with the name without the suffix.
Also, I see that you have a problem with variable definition “Variable is not set” when you up docker-compose. Maybe a problem related.

Do you have an idea how to solve it?

I tried to stop docker but it doesn’t seem to make any difference.

If it says the variable is not set I guess that is the case.

Did you create the .env folder as described here in step 6 which sets this variable?

Hi @jan,
Yes, I have my .env file:
n8n 4

And it is here:

I have been using n8n for a few months now and everything worked fine until I restarted my vps.

Could an update to a ubuntu package have caused this problem?

I tried to restart docker compose.

root@vps767290:~# docker-compose down
Removing 1571728d5124_root_n8n_1 … done
Removing root_traefik_1 … done
Removing network root_default

Same error when I restart docker.

root@vps767290:~# sudo docker-compose up -d
Creating network “root_default” with the default driver
Creating root_traefik_1 …
Creating root_traefik_1 … error
WARNING: Host is already in use by another container

ERROR: for root_traefik_1 Cannot start service traefik: driver failed programming external connectivity on endpoint root_traefik_1 (c3a02b54c7b6d4c53729f4000b69baa419610790e969638810be673010fee4c5): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use
Creating root_n8n_1 … error

ERROR: for root_n8n_1 Cannot start service n8n: driver failed programming external connectivity on endpoint root_n8n_1 (a40461194e06db6fcf609cdd50f81990cdfe1a4c62fc56b10d283f4ce367bd69): Error starting userland proxy: listen tcp 127.0.0.1:5678: bind: address already in use

ERROR: for traefik Cannot start service traefik: driver failed programming external connectivity on endpoint root_traefik_1 (c3a02b54c7b6d4c53729f4000b69baa419610790e969638810be673010fee4c5): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use

ERROR: for n8n Cannot start service n8n: driver failed programming external connectivity on endpoint root_n8n_1 (a40461194e06db6fcf609cdd50f81990cdfe1a4c62fc56b10d283f4ce367bd69): Error starting userland proxy: listen tcp 127.0.0.1:5678: bind: address already in use
ERROR: Encountered errors while bringing up the project.

However I don’t have the duplicate container anymore.

root@vps767290:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@vps767290:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3c25e62fa84d n8nio/n8n “tini – /docker-ent…” 3 minutes ago Created root_n8n_1
6e678892f3bf traefik “/entrypoint.sh --ap…” 3 minutes ago Created root_traefik_1

But I still have the 404 error on my n8n.

The server seems to be working normally because I just received a slack notification from my n8n.
But I still can’t access it, still a 404 error.

Nobody knows how to help me?

Sadly no idea what exactly is going on there. Make best sure to stop everything (docker-compose stop) and then also remove them (docker-compose rm). Then make sure that there is no other docker image running. If there are still any, remove them manually. Once you are 100% sure that everything is clean try to start again.

By removing the docker, won’t I lose my workflows?

The workflows should be saved outside of docker in a mounted folder. So if n8n is set up correctly that should be no problem.

for the installation I had followed the procedure here:

Server Setup

So I think the workflows will be well saved.

If I understand correctly, after the docker-compose rm command I would only have to do sudo docker-compose up -d

is that right?

In this the data will be totally fine.

Yes, that is correct.

Hello @frankl1, have you successfully restart your stack of containers?
I was thinking about 2 things: launch docker-compose with remove-orphans and force-recreate arguments.