ESPHome Dashboard not working on Docker desktop

Hi, I am trying to run ESPHome docker image on Docker Desktop (as Linux container) but facing an issue. I am able to bring the container up but the dashboard is not accessible via localhost:6052. Can somebody please help me on this. The following is what I have tried as yet.

  • I am able to run the same image on Ubuntu well but my requirement is to run it on a windows machine via Docker Desktop using a Linux container.
  • I can see the logs are clean and i get the following message:

INFO Starting dashboard web server on port 6052 and configuration dir /config…

  • I have also verified that the website is up and running on port 6052 by logging into the container and using curl http://localhost:6052 , I am able to get back the response as expected.
    I think esphome maps the port 6052 from the container to the host machine and so it need not be specified in the command or docker file - The image I am running on Ubuntu does not specify the port mapping. This aside , I have specified the port mapping as below in the docker compose file but that does not make a difference.
    My docker-compose file
version: '3'
services:

# ESPHOME configuration for docker running on Ubuntu
  # esphome:
  #   container_name: esphome
  #   image: esphome/esphome:latest
  #   volumes:
  #     - /home/vijay/home_assistant:/config:rw
  #     # Use local time for logging timestamps
  #     - /etc/localtime:/etc/localtime:ro
  #     - /dev:/dev
  #   network_mode: host
  #   restart: always

# ESPHOME configuration for docker running on windows
  esphome:
    container_name: esphome
    image: esphome/esphome:latest
    volumes:
      - /C/MyData/home_assistant:/config:rw
    network_mode: host
    restart: always
    ports:
      - "6052:6052"

Any help is appreciated

1 Like

I solved the issue by removing the line network_mode:host form the docker-compose file.
It seems I didnt need the networking mode as host anyway. Also host networking mode is only supported in Linux. More details on docker documentation Use Host Networking

2 Likes