Nginx Proxy Manager start up issue

I have been using Nginx Proxy Manger in my homelab for a couple of years now and a few months ago I started having issues signing into the the web interface. I have NPM installed using this docker compose file using mariadb that I got from the NPM site.

version: ‘3.8’
services:
app:
image: ‘jc21/nginx-proxy-manager:latest’
restart: unless-stopped
ports:
- ‘80:80’
- ‘443:443’
- ‘81:81’
environment:
# Mysql/Maria connection parameters:
DB_MYSQL_HOST: “db”
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: “npm”
DB_MYSQL_PASSWORD: “npm”
DB_MYSQL_NAME: “npm”
# Uncomment this if IPv6 is not enabled on your host
# DISABLE_IPV6: ‘true’
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db

db:
image: ‘jc21/mariadb-aria:latest’
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ‘npm’
MYSQL_DATABASE: ‘npm’
MYSQL_USER: ‘npm’
MYSQL_PASSWORD: ‘npm’
volumes:
- ./mysql:/var/lib/mysql

When I looked at the logs of the Nginx container I see a repeating error of

[6/24/2023] [5:58:59 PM] [Global ] › :heavy_multiplication_x: error create table `migrations` (id int unsigned not null auto_increment primary key, `name` varchar(255), `batch` int, `migration_time` timestamp) - ER_CANT_CREATE_TABLE: Can’t create table `npm`.`migrations` (errno: 13 “Permission denied”)

I looked at the logs of the mariadb container and it shows that it has booted up and is listening.

So as a hail mary attempt I restarted the the mariadb container and the logs show a good communication between the Nginx container and the mariadb container, I can sign in again without issue, everything seems to be working as per normal. No problem right? Well, as soon as I reboot this machine or rebuild this docker-compose stack, I have the same problem every time. If I restart the mariadb container again it works as intended. I cannot figure out why this keeps failing when starting.

I have looked through the docker logs and found no issues. I am at a complete loss for anything else to look at. I can’t figure out why this is happening. If anyone can point me in a direction for a fix I would greatly appreciate it.

I’m using NPM in the cloud, but am just using the bultin SQLite db. I do have another container that requires another start first. You could probably switch up the MariaDB container to depend on NPM being up. That will also stop NPM before MariaDB when shutting down.
In your current compose you have NPM waiting on the DB, but if restarting the DB fixes the issue you probably want to flip it so that DB waits on NPM.

Not sure that’s the answer, but seems like a good spot to try.

I ran into a problem when it was updated to v. 2.10 (that was 2 months ago).

So I’ve locked the version to v. 2.9.21 until I can migrate to version 3. I’ve simply done this in my Docker compose file:

image: jc21/nginx-proxy-manager:2.9.21

You could also try and see if you can spin up a new instance of the container (with no existing data) and get it to work. You would then have to migrate all your proxy host entries manually.