Run Home Assistant via Docker on an Apple Silicon

Hello,

I have an M2 Mac Mini. I am trying to get Home Assistant to run in Docker from my Mac Mini. Currently, I have the following Dockerfile:

Dockerfile

# Start the home assistant base image
FROM homeassistant/home-assistant

# Open a port to 
EXPOSE 3001

I then run docker build --tag home-assistant .. This approach successfully creates an image named “home-assistant”. When I attempt to run the image, I’m prompted to enter a port number, so I choose “0”. I’m told the container successfully starts. However, when I visit the url provided in Docker Desktop, I just see a web page that says: “This page isn’t working”

What am I doing wrong?

What are trying to achieve by creating your own image?

Thank your for your question. From my understanding, you can’t run Home Assistant image directly within Docker on Apple Silicon. Instead, you have to install a Linux image. Then, install the Home Assistant container on that image. Seems to defeat the purpose of Docker. However, I’m not a Docker expert. I just know enough to be dangerous.

Plus, I wanted to create one file such that I can just include things like a) port numbers via environment variables, b) a volume, and c) name the container. I’m not a Docker expert. I know enough to be dangerous with it. I thought this would be a good way to learn these things with the opportunity to learn about Home Assistant.

If you actually have to do that, that’s not what your dockerfile do. It just basically takes a default HA image (idk which architecture) and re-tag it.
And I guess you have to install HA Core on that linux image, not HA container, which indeed doesn’t make any sense.

You chose 0 and expected that to work (it won’t) and you are exposing 3001 (when the image does not contain any program listening on port 3001).

You have two distinct problems there.

Why not just, y’know, follow the instructions documented for running HA Container?