Run Docker compose Pi-hole with unbound and Nginx proxy Manager on a ubuntu 22.04 VM

Hi,

i tried this by myself with help of chat gpt but i did not manage to run it properly. So can somebody help me to run a docker compose container of Pi-hole with unbound and Nginx on the same VM so that Nginx manage the ports for Pi-Hole with unbound and i can reach both over same IP-Adress for Browser GUI.

Every help is welcome.

Best regards

You will need to share more details. We discussed nginx and other reverse proxies like Traefik on the forum and it would be hard to write a general and yet complete answer to everyone. If you can share what you tried so far and what the result was, what error message you got, you can get more replies.

I managed to get Nginx proxy Manager running with docker compose and following instruction:

create docker congig.json

nano config.json
{
“database”: {
“engine”: “mysql”,
“host”: “db”,
“name”: “npm”,
“user”: “npm”,
“password”: “npm”,
“port”: 3306
}
}

creacker docker-compose.yml

nano docker-compose.yml
version: “3”
services:
app:
image: jc21/nginx-proxy-manager:latest
restart: always
ports:
- 80:80
- 81:81
- 443:443
volumes:
- ./config.json:/app/config/production.json
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- db
environment:
# if you want pretty colors in your docker logs:
- FORCE_COLOR=1
db:
image: mariadb:latest
restart: always
environment:
MYSQL_ROOT_PASSWORD: “npm”
MYSQL_DATABASE: “npm”
MYSQL_USER: “npm”
MYSQL_PASSWORD: “npm”
volumes:
- ./data/mysql:/var/lib/mysql

build the conatiner

docker-compose up -d

Also i have a runnig Pi-hole with unbound on my system. But i didnßt get to manage running botch on the same VM cause of port problems.

I tried to set up botch docker compose conatiner manually and had problems that i only can load one gui cause of the Port Problems. Also i had the problem when i could see the Nginx GUI i couldn Login. I could see the Login Screen and paste my Login Data in, but i couldn´t login.

Chat gpt suggested me to set all in one .yml:

services:
pihole:
image: pihole/pihole:latest
environment:
- ServerIP=DEINE_VM_IP
restart: unless-stopped
ports:
- “53:53/tcp”
- “53:53/udp”
- “80:80/tcp”
- “443:443/tcp”
volumes:
- ‘./etc-pihole/:/etc/pihole/’
- ‘./etc-dnsmasq.d/:/etc/dnsmasq.d/’

unbound:
image: mvance/unbound:latest
restart: unless-stopped
ports:
- “127.0.0.1:5335:53/udp”

nginxproxymanager:
image: jlesage/nginx-proxy-manager:latest
restart: unless-stopped
ports:
- “81:81/tcp”
- “443:443/tcp”
- “444:444/tcp”
volumes:
- ‘./config:/config’

But as acpected i get here Port a port issue. And if i remeber right nginx didn´t work as well. I guess what i don´t get is how i set the ports rigth so that nginx and pi-hole can work on the same vm.

Chat Gpt suggest me something like this:

version: ‘3’
services:
nginx-proxy-manager:
image: jlesage/nginx-proxy-manager
ports:
- 80:80
- 81:81
- 443:443
environment:
- LETSENCRYPT_ACME_EMAIL=your_email@example.com
volumes:
- ./data:/config

pihole:
image: pihole/pihole
ports:
- 8080:80
- 53:53/tcp
- 53:53/udp
environment:
- ServerIP=your_server_ip
- TZ=your_timezone
- WEBPASSWORD=your_password
dns:
- 127.0.0.1
- 1.1.1.1

but mostly nginx doesn´t work with this conf. And to set it up with my installation guide i failed. I hope this helps you guys to help me not getting insane :smiley:

I will try to get myself into portainer: Maybe this will help me.

Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.