Automating container updates with Ouroboros
A few months ago, I started learning about containers using Docker. This has certainly been a fun experience overall (though sometimes frustrating 😛). One issue with this is rebuilding the container upon every update when you want to deploy the new image.
There is however a solution to this problem thankfully. A good friend Kieran, who also started learning Docker at around the same time as myself introduced me to Ouroboros. Kieran uses this to keep his many Discord bots up to date without having to manually rebuild and bring up each container over and over again, and this seems to work pretty well. It is unfortunate that the project has now been abandonned (last commit in 2020). However the software still functions as it should. The following guide assumes you have some basic experience with Docker. If you have no experience then there are a couple of good posts by Kieran Robson here on how to setup docker and portainer.
To set this up you will need:
- a DockerHub account
- A GitHub repo with a functioning
Docker CI #
- go to
https://github.com/your-username/your-repo/actions/newand click on
set up a workflow yourself.
- remove the existing yaml in the auto generated file and copy the contents from below into it
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
name: Publish Docker image
name: Push Docker image to multiple registries
- name: Check out the repo
- name: Log in to Docker Hub
- name: Log in to the Container registry
- name: Extract metadata (tags, labels) for Docker
- name: Build and push Docker images
- the above will build the docker image and push it to the Docker Hub as well as GitHub's registry.
- there are two fields that need editing before this will work.
password: $. These can be configured at
https://github.com/your-username/your-repo/settings/secrets/actions/new- open this in a new tab. Add your
DOCKERHUB_USERNAMEto one and DOCKERHUB_PASSWORD to another. also change
$/YOUR-IMAGE-NAME-HEREwith an appropriate name and then save. You should end up with something like this
- now go back to the action code and save it
- with any luck after some time you should have something like this in your actions tab
Ouroboros setup #
- To run Ouroboros:
docker run -d --name ouroboros \
-v /var/run/docker.sock:/var/run/docker.sock \
Then with the containers involved:
- stop the containers
- run the snippet below, filling in the details you need to
docker run -d \
--name=INSERT NAME \
-p AN-UNUSED-PORT:THE-PORT-THE-SERVICE-RUNS-ON \
--restart unless-stopped \
Note that the tag used in this workflow is
With any luck you should now have containers automatically update once you push changes to GitHub.