Skip to content

Instantly share code, notes, and snippets.

@taufiqpsumarna
Last active December 13, 2023 06:37
Show Gist options
  • Save taufiqpsumarna/229514f3bd00120f37365a4c8f12bb3f to your computer and use it in GitHub Desktop.
Save taufiqpsumarna/229514f3bd00120f37365a4c8f12bb3f to your computer and use it in GitHub Desktop.
How to optimize GitLab runner cost usage and saving cost up to 90% using spot instance | Install Docker Engine and Gitlab Runner Config
#!/bin/bash
echo "Update repository and upgrade package"
apt update && apt upgrade -y
echo "Install Docker Package"
curl -fsSLv https://releases.rancher.com/install-docker/20.10.24.sh | sudo bash
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
echo "Add current user to docker group"
sudo usermod -aG docker $USER
echo "Install Gitlab Runner"
curl -fsSLv "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
apt-get update
apt-get install gitlab-runner -y
echo "Install Docker Machine"
curl -O "https://gitlab-docker-machine-downloads.s3.amazonaws.com/v0.16.2-gitlab.23/docker-machine-Linux-x86_64"
cp docker-machine-Linux-x86_64 /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine
@taufiqpsumarna
Copy link
Author

Docker Engine 23.0+ Error Issue

As of this morning, the latest Docker release (23.0) caused issues with the docker-machine fork, resulting in GitLab Runner not being able to create autoscaling runners using the docker+machine executor. The issue is captured in #98 (closed). Many of us were using an older version of docker-machine as a workaround for the problem described in this issue, but since we now have to update to the latest release this is no longer possible.

https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/issues/109#note_1325863864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment