Automation guide
Home Assistant Docker Compose Setup: Choose Container with Eyes Open
Deploy Home Assistant Container with durable configuration, safe remote access, backups, and a clear understanding of what Home Assistant OS adds.
Published and reviewed by OpenAlt · September 25, 2026

TL;DR
Home Assistant Container is a standalone container-based installation of Home Assistant Core. This Home Assistant Docker Compose setup is a good fit when you already manage Docker on Linux and want control over updates, backups, networking, and related services.
Use Container only when you already want to own Docker, integrations, backups, updates, and adjacent services; use Home Assistant OS when you want the appliance-like path.
Container does not include Supervisor or add-ons. Home Assistant’s official guidance recommends Home Assistant OS for most users, while Container suits people who deliberately want a Docker-managed installation.
TOC
- Should you use Container or Home Assistant OS?
- Preflight
- Compose file
- Start and verify
- Optional USB and device access
- Secure remote access
- Backups, updates, and rollback
- Failure table
- FAQ
Should you use Container or Home Assistant OS?
Use Container only when you already want to own Docker, integrations, backups, updates, and adjacent services; use Home Assistant OS when you want the appliance-like path.
The official installation-method guidance describes Home Assistant OS as the recommended choice for most users. It provides a more integrated appliance experience, while Container expects you to operate the underlying Linux host and Docker environment.
Choose Home Assistant Container when:
- Docker already runs reliably on your Linux host.
- You want Home Assistant alongside other containers.
- You are comfortable handling filesystem permissions, device access, networking, and upgrades.
- You prefer maintaining your own backup and restore process.
Choose Home Assistant OS when you want Home Assistant to manage more of the platform experience for you. Container is not a cheaper version of Home Assistant OS; it is a different operating model. You trade convenience for control.
The important boundary is simple: Container runs Home Assistant Core in a container. It does not include Supervisor or the add-ons system. If your plan depends on add-ons, choose an installation method that supports them.
Preflight
Before creating the container, confirm that Docker Engine and the Docker Compose plugin work on the Linux host. Choose a durable directory for Home Assistant’s configuration. The example below uses /opt/homeassistant/config; do not place the configuration in a temporary directory or inside a disposable container layer.
Create the directory and ensure your backup system can read it. Also decide whether Home Assistant will share the host with other services. Host networking is convenient, but it means you should understand which host ports are already in use.
If you need Zigbee, Z-Wave, Bluetooth, or another USB-connected integration, identify the device path first. Do not add device mappings “just in case.”
Compose file
Save this as compose.yaml in a project directory:
services:
homeassistant:
container_name: homeassistant
image: ghcr.io/home-assistant/home-assistant:stable
network_mode: host
volumes:
- /opt/homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
This follows the official Linux installation instructions: the official image, host networking, a persistent /config mount, the host’s local time data mounted read-only, and a restart policy managed by Compose.
There is intentionally no ports: section. With host networking, the container uses the host network namespace, so a port mapping is unnecessary.
Start and verify
From the directory containing compose.yaml, start the service:
docker compose up -d
Check its state:
docker compose ps
docker compose logs --tail=100 homeassistant
Compose provides lifecycle and status commands for starting, stopping, inspecting, and recreating services; its official documentation is the reference for those operations.
When the container is running, open Home Assistant at:
http://HOST_IP:8123
Replace HOST_IP with the Linux host’s address. Complete the initial setup, create your administrator account, and confirm that /opt/homeassistant/config contains Home Assistant files. That directory is the durable state; deleting and recreating the container should not delete it.
If the page does not load, check the container logs first, then verify that another service is not using port 8123 and that the host firewall permits local access.


Optional USB and device access
USB access is optional and should be added only for integrations that require it. For a device exposed as /dev/ttyUSB0, add this service property:
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
Use the actual device path on your host. A USB device can change names after reboot or reconnection, so verify the mapping after maintenance. If the integration does not need host hardware, leave devices out.
Secure remote access
Do not expose an unauthenticated Home Assistant port directly to the public internet.
For remote access, use a VPN or an authenticated HTTPS reverse proxy. Configure authentication and TLS at the chosen access layer, restrict the host firewall, and expose only the protected endpoint. Never assume that omitting ports: makes the service private: host networking still makes Home Assistant’s listening port a host-level network service.
Test remote access from a different network, not only from the same LAN. Confirm that authentication is required, HTTPS is enforced where applicable, and administrative access is not accidentally reachable through a broad firewall rule.
Backups, updates, and rollback
Back up the complete /config directory, which is /opt/homeassistant/config in this example. It contains the Home Assistant configuration and the operational state needed to recreate the installation. A backup that includes only selected YAML files may not be sufficient.
Use a backup destination separate from the Docker host when possible. Protect secrets and test restoration periodically. A useful restore test is to copy the backup into a clean configuration directory, point a temporary Compose project at that directory, start it without exposing it publicly, and verify that the expected integrations and automations appear.
For an update:
docker compose pull
docker compose up -d
docker compose logs --tail=100 homeassistant
Because the file uses the stable image tag, pulling checks for a newer stable image. Read the logs after every update and verify the web interface, automations, integrations, and hardware.
Plan rollback before you need it. Record the currently running image identifier before updating, retain the previous image locally when practical, and keep a known-good configuration backup. If an update fails, restore the compatible configuration backup if necessary and change the Compose image reference back to the previously recorded image or digest. Then recreate the service and verify the logs.
A rollback is not complete until the system performs its important jobs again. Test at least one automation, one critical integration, and any hardware-dependent workflow.
Failure table
| Symptom | Likely cause | First check |
|---|---|---|
| Page does not load | Container stopped, port conflict, or firewall rule | docker compose ps, logs, and host port 8123 |
| Settings disappear after recreation | /config is not mounted to a durable path | Confirm the volume mapping and host directory |
| USB integration is missing | No device mapping or wrong device path | Verify the host device and devices entry |
| Container restarts repeatedly | Configuration or startup error | docker compose logs homeassistant |
| Update breaks an integration | Image or configuration compatibility issue | Restore the known-good image and config backup |
| Remote access is unsafe | Raw port forwarding or missing authentication | Remove public 8123 exposure and use VPN or protected HTTPS |
Next steps
If Container matches your maintenance style, continue with the official Linux installation guide, then explore OpenAlt’s self-hosted directory, the Automation directory, and the self-hosting beginner guide.
FAQ
Is Home Assistant Container the same as Home Assistant OS?
No. Container runs Home Assistant Core as a standalone container. Home Assistant OS is a more integrated, appliance-like installation method and is recommended for most users by Home Assistant’s official guidance.
Does Container include add-ons?
No. Do not expect Supervisor or add-ons in the Container installation. If add-ons are central to your setup, choose a supported installation method that provides them.
Why use host networking?
Host networking lets Home Assistant use the host network directly and avoids a separate ports: mapping. It can simplify local discovery, but it also means you must manage host-level port conflicts and firewall exposure carefully.
What should be backed up?
Back up the complete persistent /config directory, including /opt/homeassistant/config in this example. Test restoring it in a clean environment so you know the backup is usable.
Can you expose port 8123 directly?
You can, but you should not expose it to the public internet without protection. Prefer a VPN or an authenticated HTTPS reverse proxy, and verify remote access from outside your home network.