We'll install Docker to run BrewPi in a container. This keeps it nicely isolated from the rest of the system and makes it easy to deploy.

Install Docker

Install docker following these instructions:

https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/

Deploy the brewpi container

Get the latest Ubuntu based image brewpi image

docker pull brewpi/brewpi-ubuntu

Deploy a new brewpi container. Modify the command below to to your liking, especially the port and the data location on the host (default is ~/brewpi-data). We also mount /etc/localtime and /etc/timezone to the container, so it takes the time from the host.

docker run -d --name brewpi -p 80:80 -v ~/brewpi-data:/data -v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime --restart always brewpi/brewpi-ubuntu

Let's break that down to explain each part.

Parameter Explanation
-d After starting the container, run it as daemon in the background.
–name brewpi Name the new container brewpi, modify this you are running multiple brewpi containers.
-p 80:80 Map port 80 of the container to port 80 of the host. If port 80 is in use, use a different port, for example 8000:80.
-v ~/brewpi-data:/data Store data and settings in ~/brewpi-data on the host.
-v /etc/timezone:/etc/timezone <br> -v /etc/localtime:/etc/localtime Use timezone from the host.
–restart always Start on boot and always restart the container when it stops.
brewpi/brewpi-ubuntu The image that is used. Usebrewpi/brewpi-raspbian for the raspberry pi, brewpi/brewpi-ubuntu for x64/x86 systems.

Connecting the BrewPi Spark via USB

If you want to connect to the BrewPi Spark over USB, you need to pass an extra argument to the container to forward the usb device, before 'brewpi/brewpi-ubuntu'.

Parameter Explanation
–device=/dev/ttyACM0:/dev/ttyACM0 Make the serial port device /dev/ttyACM0 available in the container

The full command will then be:

docker run -d --name brewpi -p 80:80 -v ~/brewpi-data:/data -v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime --restart always --device=/dev/ttyACM0:/dev/ttyACM0 brewpi/brewpi-ubuntu

Connecting the BrewPi Spark via WiFi

This step requires that you both configure the BrewPi Spark itself and your docker instance so it can find your controller on the network. Please follow this guide to configure both. Note that since you are running docker, expect the config.cfg to reside in ~/brewpi-data/settings/ or the folder you specified when ran your container.

Install the portainer web interface to manage docker containers

Portainer can make it easier to manage your running docker containers. You can install it with:

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart always --name portainer portainer/portainer

Use portainer to access the command line of the brewpi container

Try to load the portainer web interface: localhost:9000. It will ask you to set an admin password. Pick a password and set it up. Use it to log in on the next page.

On the next page, choose to first option 'Manage the Docker instance where Portainer is running' and click the Connect button.

When you have logged in, you can see your running containers. In this case, there will be a brewpi and a portainer one. If you click on the published port, this will take you to the web interface.

If you click on the brewpi container, you can click on 'console' on the container page. This will drop you directly to the command line of the container if you need it.