Switching branches when using Docker-based installs

This weekend I did a fresh reinstall on my Rpi, using Raspbian Stretch and Portainer containers. Works like a charm. I am happy to stop using updater.py to get the latest bits and instead just recreate the running container from the latest commits.

While I have no current plans to move off the master branch, I am nonetheless curious how I would cause my container to run a non-master branch such as a beta build. I assume it would involve editing the command script which creates the container.

If there is a release that is not yet ready for merging into master but needs testing, I can push a branch to docker as well.

Alternatively, you can clone the brewpi-docker repo and build a container from scratch yourself. You would just specify the branch in the docker file.

A third option is to enter a running container by providing ‘bash’ as the start command:

docker exec -it brewpi bash

Then inside the container, you can make any changes you want and optionally commit them as a new docker image. Docker works very much like git.

But to switch branches, I think you’ll have to unshallow the repository first.

Here are the instructions I received from Elco to unshallow the repo so I could checkout the legacy branch:

docker exec -it brewpi bash
git fetch --unshallow
git config remote.origin.fetch “+refs/heads/:refs/remotes/origin/
git fetch origin
git checkout legacy
cd /var/www/html
git fetch --unshallow
git config remote.origin.fetch “+refs/heads/:refs/remotes/origin/
git fetch origin
git checkout legacy
exit

1 Like

@bvehorn

I think there’s an issue with the steps as listed - it looks like the end of the “git config” lines unintentionally ended up as formatted text - were there supposed to be asterisks in there somewhere that ended up italicizing the end of the line?

@DevinB
You’re right, I should have formatted that text. Here’s the link to Elko’s instructions:

Cheers,
Bob

1 Like