How to change web admin port for docker image using host net mode?

Hi,

I'm running a docker image version of pi-hole v5.1 with net mode set to host. Now, everything works great, however, I'm using the same system for other things (i.e. homeassistant, node-red, etc.), so for other members of the household, I'd like to have a "hub" on port 80, where they can just have links with correct ports for every service. Therefore I need to move pi-hole web admin interface to a different port (8080 would be preferred). I tried changing /etc/lighttpd/lighttpd.conf and setupVars.conf files, but nothing has changed. Docs also didn't help.

Which file do I have to modify to change the port for the web admin?

Did you check documentation on Docker Pi-hole's Environment Variable?
WEB_PORT may be just what you're after.

I did and I tried adding it to setupVars.conf as WEB_PORT=8080, but nothing changed. The only way to add it as Environment Variable is to "reinstall" the container, which I can do, but I'm looking for a better solution.

I did some more research and was not able to find any solution. Fortunately, I had saved my docker run command in a .sh file and recreated the container with that modification and it works great. I'm not gonna mark that as a solution, since it's really a solution to the given problem.

Why would you think WEB_PORT should go into setupVars.conf?
As far as I can see, the documentation I've linked above doesn't mention setupVars.conf at all. You have to set this as a Docker environment variable for Pi-hole.

Also, for this kind of change, there is no need to reinstall your Pi-hole container. You either edit your docker compose configuration or the docker run command and restart Pi-hole's container.

I checked setupVars.conf and I saw a lot of configuration entries from environment variables, so I tried adding it there, but as mentioned it didn't do anything.

I'm also not using docker compose. I've started every container with docker run and set restart policies for every container. I'm using portainer to manage everything. But I might check it out.

The easiest way to change this would be to simply re-create the docker container using the docker_run.sh script from Github and choose port allocations from there.
Assuming you set up the pihole container correctly to begin with, your settings from /etc/pihole should be mapped to a directory on your host machine (maybe ~/docker/pihole)? which means that your logs and pihole settings should persist even after removing and recreating the container.