Changing web port when using Docker

How do I configure lighttpd.conf if I'm using docker? I didn't see any options to set it there.

In docker you don't need to change lighttpd port configuration. You just need to publish a different port for your container. This is how docker works.

Adding -p 8080:80 to your docker run command will publish the web interface on port 8080 (inside the container lighttpd will use the default port).

I'm using network_mode: "host"'', so I needed to get rid of the port mapping. I managed to configure and make it work using this configuration:

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
version: '3'
services:
  pihole:
    restart: unless-stopped
    container_name: pihole
    image: pihole/pihole:nightly
    network_mode: "host"
    environment:
      TZ: 'America/Sao_Paulo'
      WEBPASSWORD: 'd57d1c269f44'
      DNSMASQ_LISTENING: 'all'
    # Volumes store your data between container upgrades
    volumes:
      - '/srv/data/pihole/etc-pihole:/etc/pihole'
      - '/srv/data/pihole/etc-dnsmasq.d:/etc/dnsmasq.d'
      - '/srv/wayhome-script/pihole/lighttpd:/etc/lighttpd'
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
      - CAP_SYS_NICE paste

The drawback of that is that I needed to first start pihole, let it populate the folder, then restart it.

If you'd want to switch away from port 80 when using Docker's host network mode, simply set the WEB_PORT environment variable for your Pi-hole container.

I tried that, it didn't work for metry it that, I did it didn't work for me. I think it doesn't work since the config is hard coded in lighttpd.conf

There is code in the docker start up script to replace the one inside the container's lighttpd.conf:

That said, I see you are volume mounting the /etc/lighttpd directory. Any reason for this? This may be causing all sorts of issues!

The reason was that I couldn't make the environment variable to work (I must have done something wrong that don't know now, since you are saying that it should work), so I mainly edited the config file and created it as a mount.

This will all be much easier with the v6 container as we wont need to deal with dynamically updating lighttpd config files