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
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
ARG NODE_VERSION=16
# 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 ./
RUN \
mkdir .n8n && \
chown node:node .n8n
USER node
ENV NODE_ENV=production
ENTRYPOINT ["tini", "--", "./docker-entrypoint.sh"]
#!/bin/sh
if [ "$#" -gt 0 ]; then
# Got started with arguments
COMMAND=$1;
if [[ "$COMMAND" == "n8n" ]]; then
shift
(cd packages/cli; exec node ./bin/n8n "[email protected]")
else
exec node "[email protected]"
fi
else
# Got started without arguments
cd packages/cli; exec node ./bin/n8n
fi
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
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 ?
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.