I cannot open Invoiceninja

Version V5.11.72

Environment Docker / Synology

I have installed Invoceninja.
All containers are running fine.
I have adjusted the following in the .env: APP_URL=http://192.168.178.103:8002
I open the port in the firewall (router and Synology).

When I call up the URL via the browser, the following error message appears: Connection failed

What strikes me is that the published port is not displayed in Portainer.io.

Can anyone help me further?

Hi,

I’m not sure, but here’s what ChatGPT suggests in case it’s helpful:

Here’s a summary of your situation:

  • You installed Invoice Ninja v5.11.72 using Docker on Synology.
  • .env file is updated to APP_URL=http://192.168.178.103:8002.
  • You’ve opened the port 8002 in both the router and Synology firewall.
  • Problem: When accessing http://192.168.178.103:8002, you get “Connection failed.”
  • Clue: You notice Portainer doesn’t show the container published port.

Here’s why it probably fails:

  • If no ports are published for the Invoice Ninja container, then Docker isn’t listening on port 8002 at all, no matter what the firewall says.
  • APP_URL is only used inside the application (Laravel) — it doesn’t expose ports in Docker.

How to check and fix it

1. First check: are ports published?

In Portainer or docker ps, look at the PORTS column for your Invoice Ninja app container.

If you don’t see something like 0.0.0.0:8002->8000/tcp or anything mapped, that’s the problem.

2. Solution: Publish the port correctly

You need to recreate (or adjust) the container with the right port mapping.

Example if you use docker run:

docker run -d \
  --name invoiceninja-app \
  -p 8002:8000 \
  --env-file .env \
  invoiceninja/invoiceninja

This means:

  • Host port 8002Container port 8000 (Invoice Ninja listens on 8000 inside the container).

If you are using docker-compose, add this to your docker-compose.yml:

services:
  server:
    image: invoiceninja/invoiceninja:5
    ports:
      - "8002:8000"
    env_file:
      - .env
    # other settings like volumes etc

Then run:

docker-compose up -d

Why is the port missing in Portainer?

Because unless you explicitly publish (-p or ports: in compose), Docker isolates containers — no external connection is possible.
Portainer shows published ports only if you map them at container creation.


Quick Checklist

  • :white_check_mark: Publish port 8002 mapped to 8000 inside container
  • :white_check_mark: Make sure firewall allows 8002
  • :white_check_mark: Browser goes to http://192.168.178.103:8002
  • :white_check_mark: .env APP_URL matches the public URL

Would you like me to help you write an exact docker-compose.yml you can copy-paste for Synology?
(It’s often the easiest way on Synology setups.) :rocket:

Thank you for your quick reply!
I have corrected the port and it is now displayed. Unfortunately, I still get the same error message.

What else can I try?
Can I send you my .yml?

I’m not sure, you may want to try following up with ChatGPT yourself.

If your APP_URL ends up on Port 8002 then this port imo have to be set up in the nginx-container.
In my docker setup for invoiceninja, only the nginx-container has defined ports.

1 Like

How should I set this up?

Show your docker-compose.yml please

x-logging: &default-logging
options:
max-size: “10m”
max-file: “3”
driver: json-file

services:
app:
build:
context: .
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
restart: unless-stopped
ports:
- “8002:8000”
env_file:
- ./.env
volumes:
- ./.env:/var/www/html/.env
# - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
# - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
# - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
- /volume1/docker/invoiceninja/public:/var/www/html/public
- /volume1/docker/invoiceninja/storage:/var/www/html/storage
networks:
- app-network
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
logging: *default-logging

nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- “81:80”
volumes:
- ./nginx:/etc/nginx/conf.d:ro
- app_public:/var/www/html/public:ro
- app_storage:/var/www/html/storage:ro
networks:
- app-network
depends_on:
- app
logging: *default-logging

mysql:
image: mysql:8
restart: unless-stopped
env_file:
- ./.env
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
networks:
- app-network
healthcheck:
test: [ “CMD”, “mysqladmin”, “ping”, “-h”, “localhost”, “-u${MYSQL_USER}”, “-p${MYSQL_PASSWORD}” ]
interval: 10s
timeout: 5s
retries: 5
logging: *default-logging

redis:
image: redis:alpine
restart: unless-stopped
volumes:
- redis_data:/data
networks:
- app-network
healthcheck:
test: [ “CMD”, “redis-cli”, “ping” ]
interval: 10s
timeout: 5s
retries: 5
logging: *default-logging

networks:
app-network:
driver: bridge

volumes:
app_public:
driver: local
app_storage:
driver: local
mysql_data:
driver: local
redis_data:
driver: local

There are some errors.
Firstly, you need to decide whether you want to use the volumes as a directory-mount or as a docker volume.

Then I could adapt the compose accordingly

Sorry, that is beyond my knowledge.
What is the difference between these two?
Or what do you recommend?

I cannot get into invoice ninja either both on the app or login online

A recommendation is difficult. It’s a matter of personal taste.

This is a docker-compose.yml using docker-volumes…

x-logging: &default-logging
  options:
    max-size: “10m”
    max-file: “3”
  driver: json-file

services:
  app:
    build:
      context: .
    image: invoiceninja/invoiceninja-debian:${TAG:-latest}
    restart: unless-stopped
    #ports:
      #- "8002:8000"
    env_file:
      - ./.env
    volumes:
      - ./.env:/var/www/html/.env
      #- ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
      #- ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
      #- ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
      - app_public:/var/www/html/public
      - app_storage:/var/www/html/storage
      - app_cache:/var/www/html/bootstrap/cache
    networks:
      - app-network
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_healthy
    logging: *default-logging

  nginx:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "8002:80"
    volumes:
      - ./nginx:/etc/nginx/conf.d:ro
      - app_public:/var/www/html/public:ro
      - app_storage:/var/www/html/storage:ro
    networks:
      - app-network
    depends_on:
      - app
    logging: *default-logging

  mysql:
    image: mysql:8
    restart: unless-stopped
    env_file:
      - ./.env
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - app-network
    healthcheck:
      test: [ “CMD”, “mysqladmin”, “ping”, “-h”, “localhost”, “-u${MYSQL_USER}”, “-p${MYSQL_PASSWORD}” ]
      interval: 10s
      timeout: 5s
      retries: 5
    logging: *default-logging

  redis:
    image: redis:alpine
    restart: unless-stopped
    volumes:
      - redis_data:/data
    networks:
      - app-network
    healthcheck:
      test: [ “CMD”, “redis-cli”, “ping” ]
      interval: 10s
      timeout: 5s
      retries: 5
    logging: *default-logging

networks:
  app-network:
    driver: bridge

volumes:
  app_public:
    driver: local
  app_cache:
    driver: local
  app_storage:
    driver: local
  mysql_data:
    driver: local
  redis_data:
    driver: local

Try this with the Port 8002 in your .env file at APP-URL.
The complete APP-URL should be http://:8002

Is this correct, I have to enter the correct path on line 22, 23, 24, 41, 42.
Do I have to enter values on line 55-58?
I can accept everything else as standard.

I get the following error message during installation:
ox@Synology_DS923:/volume1/docker/invoiceninja/dockerfiles/debian$ sudo docker-compose up
Password:
WARN[0000] The “amm3nM” variable is not set. Defaulting to a blank string.
WARN[0000] The “amm3nM” variable is not set. Defaulting to a blank string.
WARN[0000] The “amm3nM” variable is not set. Defaulting to a blank string.
parsing /volume1/docker/invoiceninja/dockerfiles/debian/docker-compose.yaml: yaml: line 63: did not find expected ‘,’ or ‘]’

I was able to solve these error messages:

WARN[0000] The “amm3nM” variable is not set. Defaulting to a blank string.
WARN[0000] The “amm3nM” variable is not set. Defaulting to a blank string.
WARN[0000] The “amm3nM” variable is not set. Defaulting to a blank string.

now only this remains

parsing /volume1/docker/invoiceninja/dockerfiles/debian/docker-compose.yaml: yaml: line 63: did not find expected ‘,’ or ‘]’

I have no idea

this yml uses docker-volumes, so you don’t have to change any path.
Line 55 to 58: This Variables should be in the .env file. In docker compose there is nothing to.

If you get any errors please send your .env file without passwords.

The last error is from copy&paste. you have to change the copied " (in my case there are italic) to normal one via Search&replace in the whole docker-compose.yml file.

I have fixed it here:

x-logging: &default-logging
  options:
    max-size: "10m"
    max-file: "3"
  driver: json-file

services:
  app:
    build:
      context: .
    image: invoiceninja/invoiceninja-debian:${TAG:-latest}
    restart: unless-stopped
    #ports:
      #- "8002:8000"
    env_file:
      - ./.env
    volumes:
      - ./.env:/var/www/html/.env
      #- ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
      #- ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
      #- ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
      - app_public:/var/www/html/public
      - app_storage:/var/www/html/storage
      - app_cache:/var/www/html/bootstrap/cache
    networks:
      - app-network
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_healthy
    logging: *default-logging

  nginx:
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - "8002:80"
    volumes:
      - ./nginx:/etc/nginx/conf.d:ro
      - app_public:/var/www/html/public:ro
      - app_storage:/var/www/html/storage:ro
    networks:
      - app-network
    depends_on:
      - app
    logging: *default-logging

  mysql:
    image: mysql:8
    restart: unless-stopped
    env_file:
      - ./.env
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - app-network
    healthcheck:
      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}" ]
      interval: 10s
      timeout: 5s
      retries: 5
    logging: *default-logging

  redis:
    image: redis:alpine
    restart: unless-stopped
    volumes:
      - redis_data:/data
    networks:
      - app-network
    healthcheck:
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 10s
      timeout: 5s
      retries: 5
    logging: *default-logging

networks:
  app-network:
    driver: bridge

volumes:
  app_public:
    driver: local
  app_cache:
    driver: local
  app_storage:
    driver: local
  mysql_data:
    driver: local
  redis_data:
    driver: local

I still had problems logging in. Resetting by email didn’t work either. Now I have copied the link from the laravel.log and am logged in. I noticed that the time stamps of the log do not show the correct time. Do I still have to set the time zones? (.env or yml)

I have not yet found the optimum time zone setting either.
I once defined the time zone in each service in the docker-compose, but this resulted in various downloads generated from the app not working because they are usually only valid for 1 hour.
I don’t currently use a time zone in the individual apps. But you should set this in Invoiceninja. Settings-Localisation

Ok. Thanks for your great help!