Fresh Docker Install Fails with 'Connection reset by peer' on Ubuntu 24.04

Hello,

I’m experiencing an issue with a fresh n8n installation in Docker on a new Ubuntu 24.04 server. The container starts successfully, but it rejects all incoming network connections with a Connection reset by peer error, both directly via curl and through an Apache reverse proxy.

We have performed extensive troubleshooting and have ruled out all standard configuration issues.

Troubleshooting Summary:

  • The n8n container is stable and shows as ‘Up’ in docker compose ps.

  • The n8n logs show a successful startup with no errors.

  • The issue occurs with a direct curl -v ``http://127.0.0.1:5678, so the reverse proxy (Apache) has been ruled out as the cause.

  • We’ve confirmed all Apache modules are loaded and the config is correct.

  • File permissions on the data volume were corrected with sudo chown -R 1000:1000 n8n_data/.

  • AppArmor was tested by setting the Apache profile to ‘complain mode’, which did not solve the issue.

  • The error persists even when sending the correct Host header using curl --resolve.

  • A full data reset (docker compose down, sudo rm -rf n8n_data, docker compose pull, docker compose up) did not solve the problem.

The failure seems to be a deep environmental incompatibility. Here is my server’s information:

hello @anagin

Please, show the compose file.

services:
    n8n:
        image: docker.n8n.io/n8nio/n8n
        container_name: n8n
        restart: unless-stopped
        ports:
        - "127.0.0.1:5678:5678"
        environment:
        - N8N_PROTOCOL=https
        - N8N_HOST=n8n.palmdoc.ai
        - N8N_PORT=443
        - WEBHOOK_URL=https://n8n.palmdoc.ai/
        - TZ=America/Chicago # Make sure this is still here
        - DB_SQLITE_POOL_SIZE=5
        - N8N_RUNNERS_ENABLED=true
        - N8N_BLOCK_ENV_ACCESS_IN_NODE=false
        - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
        - N8N_SSL_ENABLED=false
        volumes:
          - ./n8n_data:/home/node/.n8n

Docker seems to be fine from the status check but local url and the URL to load the editor page is not working

you have set the n8n service to listen only the localhost

That’s why you can’t connect to it.

replace with

- "5678:5678"

another issue is with the ENV variables

N8N_PROTOCOL=https

that should be http

N8N_PORT=443

that should be 5678

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