May 20, 2020

Home Assistant in Docker with PicoTTS

One issue I discovered is that the official Home Assistant docker image does not support the PicoTTS component. The image simply does not have the PicoTTS program.

On a side note, this seems to be a known issue, but this has not been addressed.

Custom Image Creation

To get PicoTTS working, I need to add the picotts program to the Home Assistant image, resulting in my own Home Assistant image. This was surprisingly easy.

First, I created a file: homeassistant-picotts.dockerfile.

# More info here https://www.reddit.com/r/docker/comments/c8jela/can_we_add_packages_to_a_docker_container/

# Start with the official Home Assistant image
FROM homeassistant/home-assistant:latest

# Install PicoTTS
RUN apk add --no-cache picotts --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing

And then build your own image.

$ docker build -f homeassistant-picotts.dockerfile -t homeassistant-picotts .

This will create the homeassistant-picotts Docker image, which you can use in your docker-compose.yml file instead of the official Home Assistant image.

Updating Home Assistant

You will need to do this every time you update Home Assistant. Super inconvenient, but luckily, updating a Docker container is trivially easy, so adding a step isn’t the worst.