Hello everyone,
New to the community, I have been trying to install homeassistant into docker for a while. The installation was successful however I cannot access homeassistant when using port 8123 when network mode is host, I can only access it if I change it to port 8123. I am running the latest ubuntu 22.04 and freshly installed docker engine and docker desktop. I turn off the ufw firewall and also tried adding the 8123 into whitelist, still no change.
This is the running log
2022-12-06 12:02:51 s6-rc: info: service s6rc-oneshot-runner: starting
2022-12-06 12:02:51 s6-rc: info: service s6rc-oneshot-runner successfully started
2022-12-06 12:02:51 s6-rc: info: service fix-attrs: starting
2022-12-06 12:02:51 s6-rc: info: service fix-attrs successfully started
2022-12-06 12:02:51 s6-rc: info: service legacy-cont-init: starting
2022-12-06 12:02:51 s6-rc: info: service legacy-cont-init successfully started
2022-12-06 12:02:51 s6-rc: info: service legacy-services: starting
2022-12-06 12:02:51 services-up: info: copying legacy longrun home-assistant (no readiness notification)
2022-12-06 12:02:51 s6-rc: info: service legacy-services successfully started
hi
what do you mean by :
‘I cannot access homeassistant when using port 8123’
and
‘i can only access if I change it to port 8123’
isn’t clear !
do you use docker-compose? show it …
in ‘network mode: host’ you do not need to tell the port (you will use the host port (ubuntu in your case))
I am using docker compose and this is my compose file. What I mean is that when I am using that when using the compose file above I cannot reach home assistant. However when I change it to port 8123 it works please see below.
Docker Desktop will not allow network_mode: host (as previously mentioned) which prevents mDNS from working which maybe be what’s effecting Google (I don’t use Google with HA so don’t now for sure).
You can try specifying the ports required for Google as well.
I was in the same boat as you. The issue is that Docker Desktop runs inside its own virtual machine. host network mode with docker desktop means listening to the ports on the virtual machine, but there is nothing telling the actual physical machine to listen on those ports. I don’t know if you can get around this or not. Apparently host networking mode only works when running Docker natively on Linux machines. I just switched my machine over from using Docker Desktop to Docker Engine and host networking mode and network discovery in HA are finally working.
Docker Desktop is a nice little package that wraps up a few docker components into one package, including Docker Engine, Docker Compose, a GUI, and a VM. Docker Engine is basically just the “docker” portion of the code without any additional bells and whistles. Its the core of Docker. Basically Docker Desktop runs a mini Virtual Machine that runs Docker Engine, which makes it nice for distributing to other Operating Systems, and it does some setup automatically.
Docker Engine can only run on Linux machines and is completely command line based. Basically you just install it, tell it what containers to run, and it will host them, just like Docker Desktop. One downside is it doesn’t have a GUI, so you will need to use the command line to fire up containers.
You can install Docker Compose, which is a separate, but related piece of software to be able to run the .yaml files.
I am not someone who enjoys using a terminal at all, so I actually installed a container called Portainer and used its ‘stacks’ feature to run my .yaml files. If Portainer creates a container, rather than Docker itself, it is able to manage the container via the web interface.
Difference between Docker Desktop and Docker Engine
Install Docker Engine (look at the server section, not the Docker Desktop Section)
Agh, OK, so I have been using Docker engine on my Pi.
So, if you swapped from docker desktop to docker engine, and docker engine only runs on Linux and docker desktop only runs on Mac or Windows, did you change OS as well?