Hi,
I am getting the following error
service “npm-db” refers to undefined network docker_network - 192.168.20.11: invalid compose project
when trying to run
docker compose -f /srv/docker/backend/npm.yaml up
networks:
docker_network:
external: true
npm:
networks:
- docker_network
- 192.168.20.11 # the IP of the container
npm-db:
networks:
- docker_network
- 192.168.20.11 # the IP of the container
npm.yaml
secrets:
# Secrets are single-line text files where the sole content is the secret
# Paths in this example assume that secrets are kept in local folder called ".secrets"
NPM_DB_ROOT_PWD:
file: **REDACTED**
NPM_MYSQL_PWD:
file: **REDACTED**
networks:
docker_network:
external: true
services:
npm:
env_file:
- path: .env.global
required: true # default
- path: .env
required: true
container_name: ${NPM_SERVICE}
image: jc21/nginx-proxy-manager:latest
hostname: ${NPM_HOST}
ports:
- ${NPM_HTTP_PORT}:${NPM_HTTP_PORT} # Public HTTP Port
- ${NPM_ADMIN_HTTP_PORT}:${NPM_ADMIN_HTTP_PORT} # Admin Web Port
- ${NPM_HTTPS_PORT}:${NPM_HTTPS_PORT} # Public HTTPS Port
#profiles: ["core", "backend", "all"]
environment:
NPM_DB_MYSQL_HOST: ${NPM_DB_HOST}
NPM_DB_MYSQL_PORT: ${NPM_DB_PORT}
NPM_DB_MYSQL_USER: ${NPM_DB_USER}
NPM_DB_MYSQL_PASSWORD__FILE: /run/secrets/NPM_MYSQL_PWD
NPM_DB_MYSQL_NAME: ${NPM_DB}
# If you would rather use Sqlite, remove all DB_MYSQL_* lines above
# DISABLE_IPV6: 'true' # Uncomment this if IPv6 is not enabled on your host
networks:
- docker_network
- 192.168.20.11 # the IP of the container
volumes:
#- /var/run/docker.sock:/var/run/docker.sock # Optional, only if you want docker integration
- /mnt/.config/services/npm:/data
- /etc/letsencrypt:/etc/letsencrypt
secrets:
- NPM_MYSQL_PWD
depends_on:
- ${NPM_DB_SERVICE}
healthcheck:
test: ["CMD", "/usr/bin/check-health"]
interval: 10s
timeout: 3s
npm-db:
env_file:
- path: .env.global
required: true # default
- path: .env
required: true
container_name: ${NPM_DB_SERVICE}
image: jc21/mariadb-aria:latest
hostname: ${NPM_DB_HOST}
#profiles: ["core", "backend", "all"]
environment:
# MYSQL_ROOT_PASSWORD: "npm" # use secret instead
MYSQL_ROOT_PASSWORD__FILE: /run/secrets/NPM_DB_ROOT_PWD
MYSQL_DATABASE: ${NPM_HOST}
MYSQL_USER: ${NPM_DB_USER}
# MYSQL_PASSWORD: "npm" # use secret instead
MYSQL_PASSWORD__FILE: /run/secrets/NPM_MYSQL_PWD
networks:
- docker_network
- 192.168.20.11 # the IP of the container
ports:
- "${NPM_DB_PORT}:${NPM_DB_PORT}/tcp"
volumes:
#- /var/run/docker.sock:/var/run/docker.sock # Optional, only if you want docker integration
- /mnt/.config/services/mysql:/var/lib/mysql
secrets:
- NPM_DB_ROOT_PWD
- NPM_MYSQL_PWD
healthcheck:
test: ["CMD", "/usr/bin/check-health"]
interval: 10s
timeout: 3s