Updating the self-hosted GitHub runner

June 2nd 2023 GitHub Docker Synology

After I set up a GitHub self-hosted runner on my Synology NAS, it worked great for a while. Then, on a random Saturday morning, I got the following notification:

Docker container github-runner_worker_1 stopped unexpectedly. Please select github-runner_worker_1 on the Container page, click the Details button, and go to the Log tab for details.

I followed the instructions to access the logs in the Synology UI:

  • I started the Docker application.
  • I opened the Container page in the sidebar to get a list of containers.
  • I selected the GitHub runner container in the list and clicked the Details button in the top toolbar.
  • I switched to the Log tab in the newly opened window.
  • I selected the correct date in the tree view on the left to get access to the logs for that day.

It turned out that the runner was trying to update itself, but it failed to restart at the end. That's why I received the error notification. Of course, I first tried starting the container again manually. However, the runner didn't actually update itself, so the issue repeated itself the next Saturday morning at the same time.

I did some research, but I couldn't find a way to make the auto-update process to work. There's still an open issue in GitHub. One of the suggestions was to disable the automatic updates. In the container, this can be done with the DISABLE_AUTO_UPDATE environment variable. Although this should prevent the weekly failures when the runner wasn't up-to-date, I didn't like the idea, because the old version of the runner will supposedly stop working 30 days after a newer version is released:

For compatibility with the GitHub Actions service, you will need to manually update your runner within 30 days of a new runner version being available.

I was afraid that the runner would just quickly stop working because of this, without giving me any warning. So, for now, I decided to keep the automatic updates enabled. This way, I get notified when a new version of the runner is available. I can find the latest version of the runner on its GitHub Releases page. This allows me to check if there's already a new Docker image available for this version. I'm using the latest tag and when I open its details in Docker Hub, I can check in the image layers data if it uses the same version:


If that's the case, I can just use SSH to connect to my Synology, navigate to the folder with the docker-compose.yml file and run the following commands:

# download the new image
sudo docker-compose pull
# restart the container with the new image (no stop needed)
sudo docker-compose up -d

The runner should now work again without interruptions until the next version is released.

The automatic update for the self-hosted GitHub runner fails when it's running in a container, and causes it to stop. I couldn't find a way to make it work. The auto-update can be disabled, but that could mean that the runner will silently stop working 30 days after a new version is released. For now, I decided to use the failing updates as a notification that a new version is available so that I can update it manually.

Get notified when a new blog post is published (usually every Friday):

If you're looking for online one-on-one mentorship on a related topic, you can find me on Codementor.
If you need a team of experienced software engineers to help you with a project, contact us at Razum.
Creative Commons License