How to upgrade n8n with docker-compose setup?

Hello dear @jan
I install n8n on my ubuntu server by docker compose.

Can you tell me how can I upgrade to newer version?

Best regards;

1 Like

Sure. There are multiple ways. You can either add the version number of the specific version you want to update to in the docker-compose.yml file like this:

....
  n8n:
    image: n8nio/n8n:0.47.0
...

and then restart (how to restart bellow)

or you can pull the latest docker-image yourself with:

docker pull n8nio/n8n

and then after that is done, you restart.

How to restart:

# Stop current setup
sudo docker-compose stop
# Delete it (will only delete the docker-containers, data is stored separately)
sudo docker-compose rm 
# Then start it again
sudo docker-compose up -d
22 Likes

@jan - regarding upgrades are there any additional steps ever needed for versions?

I wasn’t able to find documentation regarding changes between versions.

Yes there are. They can be found here:

1 Like

Ah of course. Thanks!

Sadly not that obvious and easy to find. Sorry!

Added to my To-Do-List to improve.

1 Like

Just try to update using docker pull n8nio/n8n and now it’s 404 :frowning:
What wrong with me?

You should try turn back to 0.73.1 and turn off all workflow and try again.

1 Like

Welcome to the community @vasyablack!

The command docker pull n8nio/n8n should normally not return a 404. If it does it sounds like there is something wrong with dockerhub.

If you can pull the latest image and n8n does error on startup, then you should do exactly what @huuich mentioned. Use 0.73.1, deactivate all workflows, use latest version, activate the workflows again.

1 Like

Great! Now it’s works correctly! Thank you!

2 Likes

That was easy! Thank you!

I have been using this every single n8n update and it works like a charm.
Just wondering,

The official documentation seems to be slightly different:

Do both ways do the exact same thing?

Hey @David_Go,

It is mostly the same thing internally, stop and down will both stop the container. The only real difference is cleaning up the old containers.

1 Like

Thanks :slight_smile: good to know.

1 Like

I have been upgrading my n8n (all is working fine)
How often should I update my server?
Looks like there are 19 updates available …

Hey @David_Go,

That is down to you or if for a company it would be down to company policy. I upgrade and reboot all of my servers weekly, I don’t need to do weekly reboots but I dislike having larger uptimes.

1 Like

Hmmm well, I get to make that decision :slight_smile:
So I went ahead and made a task in clickapp to update my server every 2 weeks.
Thank you very much @Jon

1 Like

Hi everyone,

I followed this video: Installing N8N (nodemation) on my server. - YouTube to setup n8n. My version is about 6months old now… I am very much a newbie at this.

I’m trying to upgrade the n8n version but here’s the response I’m getting:
CleanShot 2022-04-22 at 09.29.25

As per the video I did setup an admin user before, but couldn’t figure out how to login to it… so just connected directly via the droplet console. Not sure if that is the problem.

Thanks in advance for your help…:pray:

Update: In the meantime found this: Docker - n8n Documentation


Tested it. But the ā€œstart the containerā€ part didn’t work…
I entered: docker run --name=name_n8n_1 -d n8nio/n8n

But won’t work, and as per below, the container ID doesn’t exist anymore… so now my entire n8n is down :sweat_smile:

Hi @Vince ,

I’m a newbie too but lets try our best to overcome your situation. As I can see you’ve installed your n8n env with a yaml file. You need to find path of this file on your VM. with cd … cd … cd … commands go back to your root directory. Then try to find your docker-compose yaml file.

find . -name *.yaml

or

find . -name *.yml

Now, you must see your yaml file. Go to the correct path and try to execute ā€œsudo docker-compose stopā€ command.

By the way, if you want to work with ā€œdockerā€ commands;

  • To start a container use docker start [container_id]
  • To stop a container use docker stop [container_id]
  • Docker run commands is not directly starting, this is similar to installing. I’m using docker run to establish containers with an env file. In your case, you can’t use docker run commands.
docker run -d --restart=always --log-opt max-size=10m --log-opt max-file=5 --name n8n-main -p 5678:5678 -v /root/n8n/.n8n:/home/node/.n8n --env-file=/root/n8n/queue.env n8nio/n8n n8n
2 Likes

Solid answer there, So the command is failing because the compose file is not in the directory you are running the command from. Depending on what else you have set up you could also try and find the file using the history command which would output ā€œallā€ the commands you have ran so you can scroll through and see what you did if you can’t remember :slight_smile:

1 Like