Custom Docker image - Unable to roll back from 0.186.0

Describe the issue/error/question

I upgraded to 0.186.0 from 0.184.0, but started facing issues with the Airtable Trigger node, system-wide. So, i then tried to roll back to 0.184.0. But every time i try it, the 0.186.0 image gets built.
Either i’m overlooking something on my end, or the wrong image is tagged at the n8n end.

My Dockerfile:

FROM n8nio/n8n:0.184.0

RUN npm install --location=global npm
RUN apk add --update python3 py3-pip
RUN npm update --location=global --include=dev

docker-compose.yml:

  n8n:
    image: my-n8n
    container_name: n8n
    ....

The commands i use to update my instance:

docker system prune -a
docker-compose pull
docker build -t my-n8n . --no-cache
docker-compose down
docker-compose up -d

Can’t figure out why i’m unable to roll back to an older version

Information on your n8n setup

  • n8n version: 0.186.0
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @shrey-42,
to make sure you are using the right n8n version, instead of this

you can build you docker image with a version tag.

docker build -t my-n8n:0.184 . --no-cache

In you docker-compose.yml you use it like this.

 n8n:
    image: my-n8n:0.184

Does this fix your issue?

1 Like

Will have to try it out. In any case, i am already deleting all unused images before creating a new one.

In the meanwhile, i did successfully try out something else:
removing RUN npm update --location=global --include=dev from my Dockerfile worked out.

It seems, that due to this update command, the earlier pulled, older version of n8n gets updated automatically.

If this behaviour is expected, could you suggest how to update my other libraries without getting n8n to also upgrade beyond the specified version?

Thanks.

1 Like

I did not see that. Yes you are right, this will update all npm packages installed in global, including n8n. Did you find the update command in one of our Dockerfiles?

Don’t remember so. But it seems like standard practice when a whole bunch of other npm libraries are also included in the Dockerfile and they need to be updated.

Hey there,
I see. If you checkout our Dockerfile you will see that we use FROM node:16-alpine as base image and do npm install -g full-icu n8n@${N8N_VERSION} , so only n8n and full_icu should be installed globally. Updating global shouldn’t be done, it’s better to update docker image versions and set fixed version like my-n8n:0.184 that align with your n8n base image version.

Have been following this recommended methodology, since the beginning, to build custom images.

Does it need to be changed now?

Hey @shrey-42,

The only thing that really needs to be changed is RUN npm install --location=global npm this will install the latest version of n8n globally which you don’t need to do if you are using our image as your source as it has already been done.

Looking at the 2 threads you linked to it doesn’t look like anyone has suggested it as an option so I suspect it was just accidentally added in at some point and only noticed now.

1 Like

Cool!

What about RUN npm update --location=global --include=dev though?
I guess i should somehow ignore n8n from the update command?

Started doing this when certain dependencies of external npm packages weren’t auto-updating and that was giving off a lot of warnings while building the Dockerfile.

Yeah you would want to exclude n8n from that, Do you have a lot of other packages you are installing?

Yes, quite a few!