I started using docker, and ended up concluding that the maturity of the HA project is too low too make sense of a docker install. You need to install specific versions of specific modules to make things work, and some of the modules need access to some of the hardware (bluetooth for example) which is not supported in docker.
My advice would be to to stick with a well documented setup where you register everything you do.
Security vice, this requires all the usual things…
@FletchNZ, I wrote this guide a few months ago, when I was in your same boat. Have a look, it may help out.
??
It’s absolutely supported in docker. I have access to my Bluetooth on my nuc through docker. Not sure where you got this info from.
Hmm, it sounds really awesome. Do you have the bluetooth/ble device trackers working inside docker?
Rgd the different versions, I am struggling with getting IKEA tradfri, all the device tracking and MQTT messaging to work, and only got it working by manually forcing different pip3 installs to make it work. Really cumbesome work. It could have been nice with a guide to “what parts of the project has been tested or not” kind of guide. I get many many error message in the error logs every minute for many parts of the setup. The IOS app is not working to me at all either, which could also have been nice.
Long story short: If you have bluetooth running nicely inside a docker container, with the 0.82.1 version of the project I must be a complete idiot - and that might have destroyed other parts of the setup.
Ups, and rgd where I have info about docker and bluetooth, here is a few that indicates problems related to HA - but I am not an expert, just trying to extract the conclusions. And it sure seems that you have found a way out.
Hi, I dont use bluetooth from the docker container. The only bluetooth component I use is happy-bubles, which I’ve installed directly on ubuntu and works fine.
Everything else is containerised and works without issues.
I would suggest you use docker compose and have a look at different compose yamls posted here.
I can share mine if you’d like
Bluetooth device tracking works just fine. If you’re not using --net=host
it won’t work, since Bluetooth is part of the network stack.
Thank you all for your replies. I’ve been furiously beating my head against this wall but I haven’t won yet.
I got as far as having Portainer, HomeAssistant, Mosquitto and Letsencrypt/Nginx container Installed. Lets encrypt sorted the certs once I fixed a missing DNS issue an i’ve set up the Nginx config but I can only get to home assistant on the IPAddress:8123. Portainer and MQTT was working fine and so was my Xiaomi gateway.
flamingm0e - I’ve been reading you Docker Compose file and I see you don’t have Nginx or the let encrypt container in there - Do you not use it? or install it separately? (Thanks for publishing it by the way, very helpful)
I’m going to start fresh, so bear with me i’m going to break it down simple.
- Install ubuntu
- Install Docker
- Install Docker Compose
- install Letsencrypt/Nginx container?
- Setup lets encrypt and Nginx subsite configs
- Setup Stack in docker Compose to get Portainer, Mosquitto, hadockermon,Home assistant and node red
- Setup those configs
Thanks for this, I have already been using it but for what ever reason I cant get it to work. As above i’m going to do a fresh build and try again
You’re welcome! I am glad it is of a little use.
I use NGINX, installed on a VPS I already have for various other things, so it is not running in my local network, but on a VPS on Digital Ocean. As for Lets Encrypt, I still deal with that manually on my VPS, as I have had my setup on there for years and hate to tear it all down to replace it (it would be a lot of work).
Basically my setup is reverse proxy running on NGINX (and handles my certs) on my VPS, and my home firewall only allows traffic to my Home Assistant install from my public IP on my VPS (it’s a static IP). One day I will get around to performing either an SSH tunnel or a VPN between the VPS and my home network.
Ah ok, thanks for that. I’ve read too many different guides - some were installing lets encrypt outside of docker and I was wondering if that was what you had done.
So no problem putting the LetsEncrypt container in the docker compose file with the rest of the containers?
Should be no problem at all. If you use the linuxserver letsencrypt container it will run nginx and let’s encrypt for you.
Hi Guys,
im a bit stumped, lets encrypt and node red containers wont start cause something is using their ports
ERROR: for letsencrypt Cannot start service letsencrypt: driver failed programming external connectivity on endpoint letsencrypt (66acdfad8737d0259b89808b474dab50e0cb1b596c755e4265973835e31fb0e7): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use
When I run netstat -tulpn I can see something using both those ports but not what. They are also IPV6 addresses but there isnt anything using the ports on IP4.
tcp6 0 0 :::1880 :::* LISTEN -
tcp6 0 0 :::443 :::* LISTEN -
Any idea what i’ve done wrong?
using netstat -ptln it shows docker-proxy is using the ports, ill keep digging.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 600/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2347/sshd
tcp 0 0 0.0.0.0:8123 0.0.0.0:* LISTEN 2427/python
tcp6 0 0 :::80 :::* LISTEN 1492/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 2347/sshd
tcp6 0 0 :::1880 :::* LISTEN 1505/docker-proxy
tcp6 0 0 :::443 :::* LISTEN 1478/docker-proxy
tcp6 0 0 :::8126 :::* LISTEN 1456/docker-proxy
Also for completeness this is my stack I am running
version: '3'
services:
portainer:
container_name: portainer
image: portainer/portainer
volumes:
- /home/hass/svr/docker/portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "9000:9000"
homeassistant:
container_name: home-assistant
restart: unless-stopped
image: homeassistant/home-assistant
volumes:
- /home/hass/svr/docker/hass-config:/config
- /etc/localtime:/etc/localtime:ro
- /home/hass/svr/docker/hass_media:/media
network_mode: host
privileged: true
nodered1:
container_name: node-red-1
restart: unless-stopped
image: nodered/node-red-docker
depends_on:
- "homeassistant"
user: root
volumes:
- /home/hass/svr/docker/node-red-1/user:/data
- /etc/localtime:/etc/localtime:ro
ports:
- "1880:1880"
letsencrypt:
image: linuxserver/letsencrypt
container_name: letsencrypt
restart: unless-stopped
cap_add:
- NET_ADMIN
volumes:
- /etc/localtime:/etc/localtime:ro
- /home/hass/svr/docker/letsencrypt/config:/config
environment:
- PGID=1000
- PUID=1000
- EMAIL=removed
- URL=removed
- SUBDOMAINS=home,port,nred
- VALIDATION=http
- TZ=removed
ports:
- "80:80"
- "443:443"
what??? Bull…t
For anyone else trying to fix this error,
“Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use”
Here is what I did:
-
Update everything
sudo apt update
sudo apt upgrade -
Run “sudo netstat -ptln” and note the ####/docker-proxy number
-
Run “sudo kill ####” for each docker-proxy that has the port you want free
-
Run “docker network prune”
-
now go to your docker compose yaml location and run “docker-compose up”
It will take a while for everything to run first time.
Now I get a “Welcome to our server” “The website is currently being setup under this address” web page so this is my next issue to solve.
#####Edit
It seems this is temporary fix, as it goes back to using the ports after each reboot
#####Update - Fixed
I rebuilt the machine, and instead of installing docker from dockers repo I installed it from ubuntu’s repo
Install Docker for ubuntu repo
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
Install Docker-compose for ubuntu repo
sudo apt install docker-compose
Run sudo docker-compose
Thanks, I managed to get everything working a few hours ago. The last thing left is picking an external database, so I need to research which one I want.
It feels so good to get it working on a NUC in docker with at reverse proxy and everything!