I am trying to build a custom docker image by doing some customizations. But getting error while running the built image

I am trying to create a custom docker image by adding few changes in the n8n. I tried building the image. The image was built successfully. But when i try to run the built image, I am using the built image in docker-compose file. When I try to run it, I am getting n8n_1 | [FATAL tini (7)] exec ./docker-entrypoint.sh failed: No such file or directory

I am using files from n8n/docker/images/n8n-custom at master · n8n-io/n8n · GitHub.

Please help.

I am using the files from n8n-custom

@Mahesh_Thiru Can you please run the docker image directly and see if that works?

docker run -it --rm --name n8n -p 5678:5678 n8n-custom-image-name

Hello @netroy , Thank you for the response. No It does not work as well. Getting same error.

Did you modify the Dockerfile?
The default entry point is ./docker-entrypoint.sh which resolves to /home/node/docker-entrypoint.sh, but your screenshot says that it’s looking for /docker-entrypoint.sh in the root folder.

No I did not modify the docker file. I attaching the files that I have now from my vscode


# 1. Create an image to build n8n
FROM n8nio/base:${NODE_VERSION} as builder

COPY turbo.json package.json .npmrc pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json ./
COPY scripts ./scripts
COPY packages ./packages

RUN corepack enable && corepack prepare --activate
RUN chown -R node:node .
USER node

RUN pnpm install --frozen-lockfile
RUN pnpm build
RUN rm -rf node_modules
RUN NODE_ENV=production pnpm install --prod --no-optional
RUN find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf
RUN rm -rf patches .npmrc *.yaml node_modules/.cache packages/**/node_modules/.cache packages/**/.turbo .config .cache .local .node /tmp/*

# 2. Start with a new clean image with just the code that is needed to run n8n
FROM n8nio/base:${NODE_VERSION}
COPY --from=builder /home/node ./
COPY docker/images/n8n-custom/docker-entrypoint.sh ./

	mkdir .n8n && \
	chown node:node .n8n
USER node
ENV NODE_ENV=production
ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]

if [ "$#" -gt 0 ]; then
  # Got started with arguments

  if [[ "$COMMAND" == "n8n" ]]; then
    (cd packages/cli; exec node ./bin/n8n "[email protected]")
    exec node "[email protected]"

# Got started without arguments
cd packages/cli; exec node ./bin/n8n

These are the same files from the below path

I don’t see anything wrong in the files you posted. but to double check, I cloned a fresh copy of the repo, ran docker build -t n8n-custom -f docker/images/n8n-custom/Dockerfile . to build an image, and was able to run it without any issues via docker run -it --rm --name n8n -p 5678:5678 n8n-custom.

Can you please post the output of this command:
docker history n8n-custom-1 --no-trunc --format "{{.CreatedBy}}"|grep ENTRYPOINT

Can you find the output below.

do you by any chance have a volume in your compose file that mounts to /home/node ?

Yes. I confirm that I have it.

version: '3.8'


x-shared: &shared
  restart: always
    - DB_TYPE=postgresdb

    - n8n_storage:/home/node/


    <<: *shared
    image: n8n-custom-1:latest
      - DB_TYPE=postgresdb
      - N8N_EMAIL_MODE=smtp
      - N8N_SMTP_PORT=465
      - N8N_SMTP_HOST=***
      - N8N_SMTP_USER=***
      - N8N_SMTP_PASS=****
      - N8N_SMTP_SENDER=***
      - N8N_SMTP_SSL=true
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=***
    command: /bin/sh -c "n8n start --tunnel"
      - 5678:5678

can you change n8n_storage:/home/node/ to n8n_storage:/home/node/.n8n please?

I’ll update the sample docker-compose files in the repo to do the same.

If this works for you, we’d need to run another command to move any data in the volume’s .n8n folder to the root of the volume.

Hello @netroy

I changed the compose file. But getting the below error now.

Not sure, if this is because of my python version. Please suggest.

I’ve created a PR to move the entrypoint file for custom images so that it doesn’t get overwritten like this.

Regarding the new error, are you on an ARM machine? like an M1 mac?

Not sure about that.

But Not a Mac definitely!!

Hello @netroy ,

After Multiple attempts I am unable to figure out whats wrong in my docker-compose.yml. However, Now I can confirm that
docker run -it --rm --name n8n -p 5678:5678 n8n-custom
Command runs n8n in my local. But still I am getting

n8n_1 | /bin/busybox:1
n8n_1 | ELF
n8n_1 | ^
n8n_1 |
n8n_1 | SyntaxError: Invalid or unexpected token
n8n_1 | at Object.compileFunction (node:vm:360:18)
n8n_1 | at wrapSafe (node:internal/modules/cjs/loader:1084:15)
n8n_1 | at Module._compile (node:internal/modules/cjs/loader:1119:27)
n8n_1 | at Object.Module._extensions…js (node:internal/modules/cjs/loader:1209:10)
n8n_1 | at Module.load (node:internal/modules/cjs/loader:1033:32)
n8n_1 | at Function.Module._load (node:internal/modules/cjs/loader:868:12)
n8n_1 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
n8n_1 | at node:internal/main/run_main_module:22:47

Below error when I refer the image in my docker-compose.yml and use docker-compose up. Please let me know what I am doing wrong. Is this issue related to OS compatability of the commands in docker-compose.yml ?

Can you run the published latest image from docker hub? or are you seeing the same issue with that as well?

Hello @netroy ,

I ran the image from docker hub

It Works perfectly. No issues with that.

So, the issue seems to be that you have command defined in the docker-compose file, which isn’t compatible with the default entrypoint on these custom images.

If you change command from /bin/sh -c "n8n start --tunnel" to just n8n start --tunnel, that should fix the issue.


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