From 83e008be84fb24a638b9e0a6ee9793974f214e07 Mon Sep 17 00:00:00 2001 From: mvgrimes Date: Wed, 20 Dec 2017 06:27:23 -0500 Subject: [PATCH] Improves documentation on deploying via docker (ex: devices and compose) (#3981) * Removes extraneous paragraph from docker documentation It looks like this line was intended to go somewhere else, but got erroneously bumped into the `Restart` section. * Adds instructions to expose devices when deploying under docker * Adds info about `docker-compose.yml` configuration to docker deployments The docker command is pretty complicated and doesn't support automated restarts. I think most users with want to use `docker-compose` (or `docker swarm`) to deploy. --- source/_docs/installation/docker.markdown | 50 ++++++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/source/_docs/installation/docker.markdown b/source/_docs/installation/docker.markdown index cd8f8b26eef..0b327c90076 100644 --- a/source/_docs/installation/docker.markdown +++ b/source/_docs/installation/docker.markdown @@ -78,9 +78,55 @@ If you want to use a USB Bluetooth adapter or Z-Wave USB Stick with Home Assista ### {% linkable_title Restart %} -This will launch Home Assistant and serve the web interface from port 8123 on your Docker host. - If you change the configuration you have to restart the server. To do that you have 2 options. 1. You can go to the service developer tool icon service developer tools, select the service `homeassistant/restart` and click "Call Service". 2. Or you can restart it from a terminal by running `docker restart home-assistant` + +### {% linkable_title Docker Compose %} + +As the docker command becomes more complex, switching to `docker-compose` can be preferable and support automatically restarting on failure or system restart. Create a `docker-compose.yml` file: + +```yaml + version: '3' + services: + web: + image: homeassistant/home-assistant + volumes: + - /path/to/your/config:/config + - /etc/localtime:/etc/localtime:ro + restart: always + network_mode: host +``` + +Then start the container with: + +```bash +$ docker-compose up -d +``` + +### {% linkable_title Exposing Devices %} + +In order to use z-wave, zigbee or other components that require access to devices, you need to map the appropriate device into the container. Ensure the user that is running the container has the correct privileges to access the `/dev/tty*` file, then add the device mapping to your docker command: + +```bash +$ docker run -d --name="home-assistant" -v /path/to/your/config:/config -v /etc/localtime:/etc/localtime:ro --device /dev/ttyUSB0:/dev/ttyUSB0 --net=host homeassistant/home-assistant +``` + +or in a `docker-compose.yml` file: + +```yaml + version: '3' + services: + web: + image: homeassistant/home-assistant + volumes: + - /path/to/your/config:/config + - /etc/localtime:/etc/localtime:ro + devices: + - /dev/ttyUSB0:/dev/ttyUSB0 + - /dev/ttyUSB1:/dev/ttyUSB1 + - /dev/ttyACM0:/dev/ttyACM0 + restart: always + network_mode: host +```