Docker image is distroless - cannot install git/gh CLI (need extensible variant)

Bug Report for n8n
Describe the problem: In n8n v2.x, the n8nio/n8n:latest Docker image appears to be distroless (or minimal), lacking package managers (apk, apt-get), shell utilities (cat, ls, bash), and the ability to install additional tools like git or gh (GitHub CLI) which are commonly needed in workflows. In n8n v1.x, it was possible to extend the Docker image with a simple Dockerfile:
FROM n8nio/n8n:latest
USER root
RUN apk add --no-cache git github-cli
USER node
This no longer works in v2.x because:
apk: not found (Alpine package manager missing)
apt-get: not found (Debian package manager missing)
Even basic commands like cat and ls return “Command not found”
What is the error message:
/bin/sh: apk: not found
Error: Command “cat” not found
Expected behavior: One of the following solutions would help:
Provide an extensible variant of the image (e.g., n8nio/n8n:latest-alpine or n8nio/n8n:latest-debian) that includes package managers
Document the recommended approach for adding tools like git/gh to the distroless image
Include git and gh CLI by default in the image since they’re commonly used in automation workflows
Use case: Many workflows require git operations or GitHub CLI commands for:
Automating repository management
Creating pull requests
Triggering deployments
Version control operations
Your debug info:

  • n8nVersion: 1.123.5 → upgrading to 2.x
  • platform: docker (self-hosted)
  • nodeJsVersion: 22.21.0
  • database: sqlite>

Updating to v2 stopped my project. This is a bug as it use to work perfectly on on V1.**. But the bot rejected it. n8n v2 Docker image is distroless - cannot install git/gh CLI (need extensible variant) · Issue #23603 · n8n-io/n8n · GitHub

The idea is:

My use case:

I think it would be beneficial to add this because:

Any resources to support this?

Are you willing to work on this?

Literally my problem this morning! I checked everything in Breaking Changes file, no mentions of this nuance

1 Like

Here’s a possible solution: n8n 2.1.0 alpine missing apk causing custom builds to fail · Issue #23246 · n8n-io/n8n · GitHub

# Reinstall apk-tools since n8n removes it
RUN ARCH=$(uname -m) && \
    wget -qO- "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/${ARCH}/" | \
    grep -o 'href="apk-tools-static-[^"]*\.apk"' | head -1 | cut -d'"' -f2 | \
    xargs -I {} wget -q "http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/${ARCH}/{}" && \
    tar -xzf apk-tools-static-*.apk && \
    ./sbin/apk.static -X http://dl-cdn.alpinelinux.org/alpine/latest-stable/main \
        -U --allow-untrusted add apk-tools && \
    rm -rf sbin apk-tools-static-*.apk

# Now apk works normally
RUN apk add --no-cache ffmpeg pipx

USER node
3 Likes

You made my day. Thank you and Merry Christmas! :smiley:

1 Like