Install Docker BuildX on Ubuntu Server

Overview

So I need to update my Jenkins to build for arm platform as I move to Hetzner from Digital Ocean (much cheaper) and I selected an arm server.

Here is the guide to install docker buildx so you can build container images for arm platform

# Update package list and install prerequisites
apt-get update
apt-get install -y ca-certificates curl gnupg

# Add Docker's official GPG key
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  tee /etc/apt/sources.list.d/docker.list > /dev/null

Then install docker buildx

# Update the package list with the new repo
apt-get update

# Install the buildx plugin
apt-get install -y docker-buildx-plugin

docker run --privileged --rm tonistiigi/binfmt --install all

Then restart docker service

Leave a Comment