Custom Docker image - Deployment error

Describe the problem/error/question

In order to include external npm modules, I’m building a custom Docker image using the Dockerfile provided here:

  • Here’s my customised Dockerfile:
FROM n8nio/base:${NODE_VERSION}

RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi

ENV NODE_ENV=production
RUN set -eux; \
	apkArch="$(apk --print-arch)"; \
	case "$apkArch" in \
	'armv7') apk --no-cache add --virtual build-dependencies python3 build-base;; \
	esac && \
    npm install -g node-html-parser --save && \
    npm install -g ssh2-sftp-client && \
    npm install -g chance && \
    npm install -g jimp && \
    npm install -g uuid && \
    npm install -g yup && \
	npm install -g simple-crypto-js --save && \
	npm install -g --omit=dev n8n@${N8N_VERSION} && \
	case "$apkArch" in \
	'armv7') apk del build-dependencies;; \
	esac && \
	find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*" -o -name "*.vue" | xargs rm && \
	rm -rf /root/.npm

COPY ./ /

	mkdir .n8n && \
	chown node:node .n8n
USER node
ENTRYPOINT ["tini", "--", "./"]
  • The docker-compose.yml section responsible for building this Docker image:
      context: .
      dockerfile: ./n8n/Dockerfile
    container_name: n8n

What is the error message (if any)?

Console error whenever i bring up the n8n container:

[FATAL tini (6)] exec / failed: Permission denied

Information on your n8n setup

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

There seems to be an issue with the Entrypoint syntax.
Correct one - ENTRYPOINT ["tini", "--", ""]

But now, even though the

error has gone, n8n doesn’t start.
It seems to be stuck in a restart-loop.

Are you seeing an error now?

No errors. No logs at all.

The container keeps restarting every 60 seconds.

Odd I would have expected something in the log, Does it not even say n8n is starting?

Nope, nothing.
Even tried manually sending the command,
docker exec n8n n8n.
Gives only an error:

Error response from daemon: Container 301ff58bb949a10ce4e20c307117f20ad6232de3ba104f6dbdf522ab881da5e7 is restarting, wait until the container is running

What about the docker log command?

No output.

I wonder if there is something else missing from your dockerfile… Have you tried a simplier Dockerfile like the one below instead of going all out?

FROM n8nio/n8n:latest

USER root
RUN npm install -g node-html-parser ssh2-sftp-client chance jimp uuid yup simple-crypto-js
USER node

Used to use a simple dockerfile similar to this, until i switched over to the ‘recommended’ version.

Did try to bring this up just now.

Error: EACCES: permission denied, open '/home/node/.n8n/crash.journal'
2023-09-04T08:11:28.877Z | error    | Error: Exiting due to an error. "{ file: 'ErrorReporterProxy.js', function: 'report' }"
2023-09-04T08:11:28.881Z | error    | Error: EACCES: permission denied, open '/home/node/.n8n/crash.journal' "{ file: 'ErrorReporterProxy.js', function: 'report' }"

What is the ‘recommended’ version? The full example we give tends to be for more complex setups :slight_smile: Looks like error now is permission based so in theory running the command from the migration guide will sort it out.

The container did come up now, after setting the permission as per the migration guide, but still having issues with working:

Editor is now accessible via:
RangeError: Invalid status code: 1008
    at new NodeError (node:internal/errors:399:5)
    at ServerResponse.writeHead (node:_http_server:344:11)
    at ServerResponse.writeHead (/usr/local/lib/node_modules/n8n/node_modules/on-headers/index.js:44:26)
    at ServerResponse._implicitHeader (node:_http_server:335:8)
    at ServerResponse.end (/usr/local/lib/node_modules/n8n/node_modules/compression/index.js:103:14)
    at ServerResponse.send (/usr/local/lib/node_modules/n8n/node_modules/express/lib/response.js:232:10)
    at Push.handleRequest (/usr/local/lib/node_modules/n8n/dist/push/index.js:37:30)
    at /usr/local/lib/node_modules/n8n/dist/push/index.js:101:68
    at newFn (/usr/local/lib/node_modules/n8n/node_modules/express-async-errors/index.js:16:20)
    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)

was referring to this:

The issue seems resolved for now, after following this:

1 Like

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