compasspopla.blogg.se

Docker network host explain
Docker network host explain













I'm not too bothered if the rest of the network can access the DB. I had commented it back out because it broken my existing setup! I didn't explain myself very well so sorry for the confusion. Yeah in order for some homeassistant devices to work I need it to be able to "See" the whole network with the ` network_mode: "host" in the settings. That's probably true but I don't know the docs for that part off the top of my head. So because it's normal dns resolution because of ```network_mode: "host"``` I need to use normal network resolution rather than referring to dockers ```db``` name? Is that correct? One way to do it, (I've not tested this), in the db section change the port: section to ports:Īnd then the home_assisstant container should be able to use `postgresql://user: all the other hosts on your network won't be able to access the db on your host. If you don't need that the best practice is to limit it by default to the hosts that require access, which for you might be localhost. What you thought of doing is fine, ie `postgresql://user: the only thing is 5432 is reachable from every host on your network. Maybe to do with receiving broadcasts or something. I was thinking you just wanted 8123 to be accessible on the host, but now I realise the home_assisstant container might require the network_mode line to work. Image: homeassistant/raspberrypi3-homeassistantĮverything I said above was with the network_mode line commented out. data/postgres/data:/var/lib/postgresql/data/pgdataĬontainer_name: "homeassistant_container" I don't really understand the network bindings so I wan to try and learn so I can fix this myself going forward.Ĭontainer_name: "homeassistant_db_container" or but this doesn't feel as clean or as robust as it could be. How do I attach homeassistant to the host AND keep the database connection working? I guess I could change the database host from db to the pi's url or network name (eg. Unfortunately this breaks the connection with the database so that I can't use the url any longer. When I do this I can indeed bind to the host and homeassistant can do it's discovery of network devices etc. However I need to bind the homeassistant to the host, which I can do with network_mode: "host" which you can see commented out in my config. The homeassistant can access the database using the url I think that this is because docker has created a db binding on the host and that's why I can connect to db. A homeassistant container with port 8123 exposed and a database with 5432. I'm fairly new to docker and docker compose, so forgive me if this is a stupid question.















Docker network host explain