Docker build is not able to run apk

Describe the problem/error/question

I am following the instructions of this page to create a custom image of n8n:

Like suggested this is my dockerfile:

FROM docker.n8n.io/n8nio/n8n
RUN apk --update add curl

But the build does not complete.

What is the error message (if any)?

=> ERROR [2/2] RUN apk --update add curl                                                                                                                                    0.3s
------                                                                                                                                                                            
 > [2/2] RUN apk --update add curl:
#0 0.206 ERROR: Unable to lock database: Permission denied
#0 0.207 ERROR: Failed to open apk database: Permission denied
------
Dockerfile:2
--------------------
   1 |     FROM docker.n8n.io/n8nio/n8n
   2 | >>> RUN apk --update add curl
--------------------
ERROR: failed to solve: process "/bin/sh -c apk --update add curl" did not complete successfully: exit code: 99

For your info, I am trying to build an image for ARM processor, but I assume the image for both processors should behave the same.

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hey @Martin_Neumann,

It is likely to be the user, try the below and see if that works.

FROM docker.n8n.io/n8nio/n8n
USER root
RUN apk --update add curl
USER node

Thanks, that worked. Can you update the documentation on the link above, so that the next person does not need to ask for this solution?

Popped in a PR to update it which can be found below.