Latest and 2.3.1 docker images do not include package manager (apk)

Describe the problem/error/question

My workflows require curl and ffmpeg to be installed locally, when attempting to build the extended image with these utilities, the build fails. After removing the apk update lines and ssh’ing into the container I receive the following errors:
/home/node # apk add --update add curl
sh: apk: not found

/home/node # ./sbin/apk
sh: ./sbin/apk: not found

/home/node # cat /etc/os-release
NAME=“Alpine Linux”
ID=alpine
VERSION_ID=3.23.0
PRETTY_NAME=“Alpine Linux v3.23”
HOME_URL=“https://alpinelinux.org/”
BUG_REPORT_URL=“https://gitlab.alpinelinux.org/alpine/aports/-/issues”

What is the error message (if any)?

N/A

Please share your workflow

N/A

Share the output returned by the last node

N/A

Information on your n8n setup

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

Hi @Matt_Marchio,

Because it is a hardened image, apk is removed for security reasons. Your options are

  1. Build your own image with the tools installed which you need (Recommended)
  2. Install apk back into your existing container

Install apk on running container:

wget https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.4/x86_64/apk.static

then

chmod +x apk.static
./apk.static -X http://dl-cdn.alpinelinux.org/alpine/v3.22/main -U --allow-untrusted --initdb add apk-tools

Node this last approach will be undone everytime you down your docker compose or remove the container

1 Like

Thanks, updated my extended image.

This is an issue that many of us have run into recently especially if you rely on tools like ffmpeg or use custom images in general,

So far, the easiest solution is to restore apk without hard-coding URLs, as discussed here:

FROM alpine:latest AS alpine

FROM n8nio/n8n:latest

# Copy apk and its deps from Alpine

COPY --from=alpine /sbin/apk /sbin/apk

COPY --from=alpine /usr/lib/libapk.so* /usr/lib/

USER root

RUN apk add --no-cache ffmpeg

USER node

This solution is for the main n8n instance, but you can also tweak it to apply only to runners..

Hopefully, n8n will address this properly soon by providing alternative image tags..

I just dropped the original solution into my dockerfile and rebuilt it

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.