Docker-compose for MQTT & Home Assistant

I found the, for me, easiest way to upgrade a set of Docker containers.

The setup is based on docker-compose.yml files and volumes in the same directory. Installing is as simple as creating the docker-compose.yml file and starting it up.

Create a docker-compose.yml in the directory where you would like to store your container, your configuration and data will be also stored here.

Start the container with:

docker-compose up -d

This will download the images, start the container and create the default configuration files. Now its time to edit those to your liking.

Restart the containers when you have configured Home Assistant and the MQTT Server:

docker-compose stop

docker-compose start

Upgrading your installation is done by stopping, removing, pulling new images and starting the containers again. Your docker volumes are static in this process, data in the ./config ./log ./data folders isn’t removed. So within seconds everything is upgraded and running with your own config. (As long as the configuration syntax is not changed between versions.)

Upgrade procedure:

docker-compose stop

docker-compose rm

docker-compose pull

docker-compose start

I’ve hosted this files on GitHub here: