Matthew_K Posted May 29, 2023 Share Posted May 29, 2023 I am currently attempting to containerize my existing VM Environment by using Docker Containers for each service that is running on the VM. These services include phpBB, MediaWiki, phpMyAdmin, MariaDB, and others. I have successfully set up everything so that all the containers start correctly, and when I expose the necessary ports, the containers become accessible on the network. Now, my objective is to create a front-end interface for these containers using Nginx, which will be configured to point to a secondary IP address, specifically 192.168.1.51 (please note that the main Unraid IP is 192.168.1.90). Initially, I attempted to achieve this by installing Nginx-Proxy-Manager-Official as a Docker plugin. This allowed me to get the secondary IP working properly, but unfortunately, I was unable to access the other services. To overcome this challenge, I came up with the idea of deploying Nginx-Proxy-Manager-Official within the same Docker compose stack that runs all my other containers. Below, you can find the setup I have in mind: ------------------- ----------------------- ----------- .---| port:80- exposed |---| host / lan can access | | container |----< ------------------- ----------------------- ----------- '_ ------------------- ----------------------- '-| 172.20.0.0/24 |---| access to 172.20.0.2 | ------------------- ----------------------- I'm unsure whether this approach will achieve the desired outcome or if I am unnecessarily complicating the process. I am posting my docker-compose.yaml file. It should work out of the box for turning up a test environment. version: "3" volumes: dbdata: networks: backend: driver: bridge ipam: config: - subnet: 172.20.0.0/24 services: nginx: container_name: Nginx-Proxy-Manager-Official image: jc21/nginx-proxy-manager:latest restart: unless-stopped ports: # These ports are in format <host-port>:<container-port> - 192.168.1.51:80:80 # Public HTTP Port - 192.168.1.51:443:443 # Public HTTPS Port - 192.168.1.51:81:81 # Admin Web Port # Add any other Stream port you want to expose # - '21:21' # FTP # Uncomment the next line if you uncomment anything in the section # environment: # Uncomment this if you want to change the location of # the SQLite DB file within the container # DB_SQLITE_FILE: "/data/database.sqlite" # Uncomment this if IPv6 is not enabled on your host # DISABLE_IPV6: 'true' volumes: - /mnt/user/appdata/Nginx-Proxy-Manager-Official/data:/data - /mnt/user/appdata/Nginx-Proxy-Manager-Official/letsencrypt:/etc/letsencrypt network_mode: br0 #networks: # - backend database: container_name: mariadb image: mariadb:latest volumes: - /mnt/user/appdata/mariadb:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=123456 # ports: # - "3306:3306" networks: - backend mediawiki: container_name: mediawiki image: mediawiki:latest volumes: - /mnt/user/appdata/mediawiki/images:/var/www/html/images # After initial setup, download LocalSettings.php to the same directory as # this yaml and uncomment the following line and use compose to restart # the mediawiki service # - /mnt/user/appdata/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php # ports: # - "8081:80" depends_on: - database - nginx environment: MW_DB_HOST: database MW_DB_NAME: mediawiki MW_DB_USER: root MW_DB_PASSWORD: 123456 networks: - backend phpbb: container_name: phpbb image: bitnami/phpbb:latest # ports: # - "8082:8080" depends_on: - database - nginx volumes: - /mnt/user/appdata/phpbb:/bitnami/phpbb environment: - PHPBB_DATABASE_USER=root - PHPBB_DATABASE_PASSWORD=123456 - PHPBB_DATABASE_NAME=phpbb3 - PHPBB_PASSWORD=123456 - MYSQL_CLIENT_DATABASE_HOST=database - MYSQL_CLIENT_DATABASE_ROOT_PASSWORD=123456 - MYSQL_CLIENT_CREATE_DATABASE_NAME=phpbb3 networks: - backend phpmyadmin: container_name: phpmyadmin image: phpmyadmin:latest ports: - "8083:80" depends_on: - database environment: - "PMA_HOST=database" - "MYSQL_ROOT_PASSWORD=123456" networks: - backend Quote Link to comment
Matthew_K Posted May 30, 2023 Author Share Posted May 30, 2023 Looks like I have made progress! 😁 This will spin up a copy of jc21/nginx-proxy-manager:latest and a simple apache webserver. The Nginx will act as the front end gateway to the rest of containers. I think this is a bug in Unraid, but the Docker Containers will only show one network but there are two on the Nginx. version: "3" services: nginx: container_name: Nginx-Proxy-Manager-Official image: jc21/nginx-proxy-manager:latest #ports: # These ports are in format <host-port>:<container-port> # - 192.168.1.123:80:80 # Public HTTP Port # - 192.168.1.123:443:443 # Public HTTPS Port # - 192.168.1.123:81:81 # Admin Web Port volumes: - /mnt/user/appdata/Nginx-Proxy-Manager-Official/data:/data - /mnt/user/appdata/Nginx-Proxy-Manager-Official/letsencrypt:/etc/letsencrypt networks: frontend: ipv4_address: 192.168.1.123 backend: # Connect the Nginx container to the backend network aliases: - nginx apache: image: httpd:latest networks: backend: # Connect the Apache container to the backend network aliases: - apache networks: frontend: name: br0 external: true backend: driver: bridge ipam: driver: default config: - subnet: 172.20.0.0/24 # Define the subnet for the backend network Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.