Skip to content

Install Docker

Since I'm going to use Docker to build my OpenFaaS functions, I need to install Docker and have buildx in it.

Note

I'm doing this only on one of my nodes, control01, so I can build arm64 native images and push them to registry, and also build OpenFaaS functions. Building OpenFaaS functions on the same node where the server is running is not recommended, and Alex Ellis told me personally that that’s not the way it should be done! You should build on your client and push to OpenFaaS gateway from there, and so on... However, I can confirm this works just fine, and it’s less hassle for me as I can also setup GitLab worker on this node and have my stuff build automatically there whenever I push to my local GitLab (GitLab is on a different server in my network, outside the scope of this guide.)

Clean slate first

Remove the installation you have now.

sudo apt remove docker docker-engine docker.io containerd runc

Install Docker

To install Docker on DietPi arm64 we are pretty much going to follow the official steps. 🙂

Install prerequisites

sudo apt-get install ca-certificates curl gnupg lsb-release

Install GPG key

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Install Repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker itself

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Edit Docker settings

Add /etc/docker/daemon.json configuration for docker daemon.

{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "insecure-registries": ["registry.cube.local:5000"],
  "experimental": true,
  "log-driver": "json-file",
  "storage-driver": "overlay2",
  "log-opts": {
    "max-size": "100m"
  }
}

Note

"insecure-registries": ["registry.cube.local:5000"] This is for insecure private registry running on HTTP, if you use TLS, you don't need this line.

Enable at boot and start docker daemon

sudo systemctl enable docker
sudo systemctl start docker

Adding support for multi-arch

Some additional packages are needed if you're going to use OpenFaaS and build on arm64.

#might already be installed
sudo apt-get install binfmt-support qemu-user-static

Did it help you ?


Last update: August 4, 2022

Comments