HomeAssistant via docker on a Mac
Several weeks ago I switched to docker on a mac mini under ubuntu server. I saw in the forums some people wanting to do it on OSX and I was about to write this article so I agreed to do it on OSX instead of Alpine Linux.
It did not go as planned. I ran into significant issues, but today I sat down to get it working.
Then I found out that someone had already updated the documentation here: https://www.home-assistant.io/docs/installation/docker/ so that should be the source of truth.
Hopefully this will be a little more straight forward since there is no intermingling with other operating systems and some assumptions in the documentation are called out expressly.
First download docker here https://store.docker.com/editions/community/docker-ce-desktop-mac
you will have to create an account in order to do so.
Once installed, fire up docker for the first time (from the applications directory, or launcher).
follow the instructions in the wizard and log in with your docker account (use your account name, not your email address).
run:
$ docker run hello-world
It did not go as planned. I ran into significant issues, but today I sat down to get it working.
Then I found out that someone had already updated the documentation here: https://www.home-assistant.io/docs/installation/docker/ so that should be the source of truth.
Hopefully this will be a little more straight forward since there is no intermingling with other operating systems and some assumptions in the documentation are called out expressly.
First download docker here https://store.docker.com/editions/community/docker-ce-desktop-mac
you will have to create an account in order to do so.
Once installed, fire up docker for the first time (from the applications directory, or launcher).
follow the instructions in the wizard and log in with your docker account (use your account name, not your email address).
run:
$ docker run hello-world
to make sure that docker is running correctlyIf you get no errors, then docker is running. Make a new config dir somewhere on your machine, I created mine named hassio right off of my home directory, so it is ~/hassio
update the following command appropriately and run it:
$ docker run -d --name="home-assistant" -v ~/hassio:/config -e "TZ=America/Denver" -p 8123:8123 homeassistant/home-assistant
version: '3'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant
volumes:
- ~/hassio:/config
- ~/hassio/etc/localtime:/etc/localtime:ro
restart: always
ports:
- "8123:8123"and run:
update the following command appropriately and run it:
$ docker run -d --name="home-assistant" -v ~/hassio:/config -e "TZ=America/Denver" -p 8123:8123 homeassistant/home-assistant
Alternatively you can use my preferred method which is docker-command and a yaml file.
in order to do that you have to make a special timezone file because it does not get mapped normally on mac osx:
$ ls -al /etc/localtime
lrwxr-xr-x 1 root wheel 34 Jan 16 2017 /etc/localtime -> /usr/share/zoneinfo/America/Denver
$ ls -al /etc/localtime
lrwxr-xr-x 1 root wheel 34 Jan 16 2017 /etc/localtime -> /usr/share/zoneinfo/America/Denver
This will show you where your localtime symlink is pointing, so update the next commands accordingly:
mkdir ~/hassio/etc
cp /usr/share/zoneinfo/America/Denver ~/hassio/etc/localtime
mkdir ~/hassio/etc
cp /usr/share/zoneinfo/America/Denver ~/hassio/etc/localtime
Now create your yaml file with the following:
version: '3'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant
volumes:
- ~/hassio:/config
- ~/hassio/etc/localtime:/etc/localtime:ro
restart: always
ports:
- "8123:8123"and run:
docker-compose up -d
Now you should be up and running. Open your browser to: http://localhost:8123 and you should be good to go!
Comments
I have run your instructions and it runs but is HA Home Assistant
0.75.2
Not hassio.
I have loaded HA non hassio version prior in docker, could that be the problem?
Thanks!
Non I would like to install HACS cut I did'n find and guide.
Do you know what to do ?
Thank
Stefano