Skip to content

Instantly share code, notes, and snippets.

@pipelinedave
Last active April 1, 2023 20:07
Show Gist options
  • Save pipelinedave/1ed2e782edda2c637c196183df75e6dd to your computer and use it in GitHub Desktop.
Save pipelinedave/1ed2e782edda2c637c196183df75e6dd to your computer and use it in GitHub Desktop.
home-assistant in docker-compose
version: '3.8'
services:
homeassistant:
build:
context: home-assistant
container_name: home-assistant
restart: unless-stopped
# Expose the Home Assistant web interface
ports:
- "8123:8123"
# Mount the configuration directory as a volume
volumes:
- ./config:/config
# Set the TZ environment variable to your time zone
environment:
- TZ=YOUR_TIME_ZONE
Create a new directory for your Docker Compose setup:
| mkdir home-assistant-docker && cd home-assistant-docker
Clone the Home Assistant repository into a subdirectory named home-assistant within the home-assistant-docker directory:
| git clone https://github.com/home-assistant/core.git home-assistant
Create a docker-compose.yml file in the home-assistant-docker directory
In the home-assistant-docker directory, create a new folder named config that will hold the Home Assistant configuration files:
| mkdir config
Run Docker Compose:
| docker-compose up -d --build
This command will build the custom Home Assistant image from the specified build context (the home-assistant subdirectory), and start the container in the background.
Access Home Assistant by navigating to http://localhost:8123 in your web browser.
Now you have a Docker Compose setup that builds the Home Assistant image from the home-assistant subdirectory where the repository has been cloned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment