Host network with docker instance
Hi there!
I'm having a problem setting up the host network from the docker, everything works but the domain that I need to use to access is http://servername:port but I want to be able to connect like http://192.168.x.x:port from another device on my local network, but next is listening only to the http://servername:port and I dont really want to setup a reverse proxy for this only.
docker-composer.yml:
services:
homarr:
container_name: homarr
image: ghcr.io/homarr-labs/homarr:latest
restart: unless-stopped
network_mode: "host"
environment:
SECRET_ENCRYPTION_KEY=xxxx PORT=7575 HOST=0.0.0.0 NEXT_PUBLIC_HOST=192.168.1.200 volumes: /var/run/docker.sock:/var/run/docker.sock ./configs:/app/data/configs ./icons:/app/public/icons ./backgrounds:/app/public/backgrounds ./data:/data if messed up something sry xD
SECRET_ENCRYPTION_KEY=xxxx PORT=7575 HOST=0.0.0.0 NEXT_PUBLIC_HOST=192.168.1.200 volumes: /var/run/docker.sock:/var/run/docker.sock ./configs:/app/data/configs ./icons:/app/public/icons ./backgrounds:/app/public/backgrounds ./data:/data if messed up something sry xD
4 Replies
Thank you for submitting a support request.
Depending on the volume of requests, our team should get in contact with you shortly.
⚠️ Please include the following details in your post or we may reject your request without further comment: - Log (See https://homarr.dev/docs/community/faq#how-do-i-open-the-console--log) - Operating system (Unraid, TrueNAS, Ubuntu, ...) - Exact Homarr version (eg. 0.15.0, not latest) - Configuration (eg. docker-compose, screenshot or similar. Use ``your-text`` to format) - Other relevant information (eg. your devices, your browser, ...)
Frequently Asked Questions | Homarr documentation
Can I install Homarr on a Raspberry Pi?
First of, your volumes are wrong. Please see https://homarr.dev/docs/getting-started/installation/docker
Then, you don't need to set it to host network mode when you just want to expose the site on port 7575 to other devices in your network. Simply expose the docker port 7575 to any port you want like in the installation guide mentioned:
The first one is the external port, so if you want to have it at port 80 accessible from another device for example you can use
80:7575
and it will be accessible from the other device with http://192.168.x.x:80Docker | Homarr documentation
Docker is our recommended installation method for beginners and professionals.
I was thinking of ussing the host network cause I setup all the firewall and things and just wanted to have it running on my lan network , otherwise if I use the default config of the homarr, i could just see what's my public ip and access the homarr via publicip:port, that's why I was wondering if there's any way of changing the next ip instead of ussing the servername
I just did another thing, I just setup another firewall to block al incomming traffic for that port from external connections that are not the LAN connection but I thought it could be change from an enviroment variable :d
however many thanks and great support :)
Sadly it is not possible to run it in host network due to some limitations, also NEXT_PUBLIC environment variables don't work as they are compiled into the application at build time