Change port config n8n installed with Docker

Dear,

I would like to know how can i change port on config n8n (port 8080) with Docker without mapping port 8080:5678 ?

Thank you for your help.

Information on your n8n setup

  • **n8n version:1.90.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): Docker localhost
  • **Operating system:Windows 10

Specify environment variable N8N_PORT

   N8N_PORT=8080

The mapping only changes how you reach n8n from outside of docker.

when i set N8N_PORT=8080 :slight_smile:


I cannot access http://localhost:8080

You’d still need the docker mapping between the container and the host-computer, but now it would be 8080 → 8080. So, if you were using docker compose, it would be…

services:
  n8n:
    environment:
      - "N8N_PORT=8080"
    ports:
      - "8080:8080"

You probably can’t set that up in the Docker Desktop UI. It looks like the only options it offers for mapping ports would have to match an EXPOSE directive in the Dockerfile that made the original image.

Is there some reason you don’t want n8n to use port 5678 within docker?

port 5678 is closed port by my enterprise (security).

FWIW, when you have a mapping in Docker from 8080 (“external” Docker-host-machine / workstation) to 5678 (for the n8n service on the “internal” Docker-container-network), the only port that would be visible to external firewall rules, etc. would be the “external” port (8080). It is unlikely that “enterprise security” rules / routing actually restrict or monitor ports, hostnames, or ip-addresses inside Docker.

actually i set 5678:5678 on start config, it’s works now.

1 Like

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