Docker not activating ports

docker
Tags: #<Tag:0x00007f0590f18c58>

#1

I’m trying to install hass.io in a docker container, but I get no network or ports. And I have no idea what I’m doing wrong. I’m using docker-compose with these settings:

version: '3'
services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant
    volumes:
      - ~/config/ha:/config
      - /etc/localtime:/etc/localtime:ro
    restart: always
    network_mode: host

But when I start it either with rebooting or docker-compose up -d it will start without assigning any network. What am I doing wrong?

As you can see in the picture Portainer works as expected.

Things I have tried:

  • Install with standard HA config
  • Delete image and fresh install

#2

my view is exactly the same.
I think potentially you have no ports showing because you’re not mapping ports, but most importantly I think it’s because network_mode: host is defined.
Again my portainer view is 100% the same so don’t think there’s an issue with Docker.
Are you having issues other than this?


#3

Seems what you said was the case. I changed my file to this, and now it seems to work:

version: '3'
services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant
    ports:
      - "8123:8123"
    volumes:
      - /home/user/config/home-assistant:/config
      - /etc/localtime:/etc/localtime:ro
    restart: always
    # network_mode: host

Thanks for the help!


#4

Not to rehash a solved thread but from your last post I think you may have missed the point.

There were no ports listed because it didn’t need to list any ports because all of the ports on the host were exposed by setting network mode to host. That means that any port that is accessed on the host can also be accessed by the container. So if you can reach 8123 on the host you can also reach the container thru 8123. There is no need to put in the “ports:” section if you have “network_mode: host” set. right now you only have one port on the host exposed to HA (8123).


#5

I’m having this problem right now. It seems that port 8123 will not resolve to my Home Assistant (Hassio) install on Docker. It works for about a day and then I can’t reach the Hassio frontend anymore. I can see that everything is running and there are no errors in the logs. Do you know why 8123 would suddenly stop resolving to Hassio?


#6

No sorry I have no idea how to troubleshoot hassio issues. I’ve never used it.


#7

Well I don’t know that it’s so much a hassio issue as an issue with docker and the host ubuntu machine not allowing port 8123. I don’t have a firewall enabled on the host so I’m not sure why the port would be closed.


#8

I’m not sure why it would be a docker/host/firewall issue either. I would think that the port would either consistently work or not based on any configuration that you have in the container. Since it works intermittently I would tend toward thinking it’s a hardware or network issue.