Ubuntu 20.04 machine image Docker is missing buildkit

I am using the machine type instance with the ubuntu-2004:202010-01 image, it seems buildkit is not installed at all with the out of the box version of docker on the image. It looks like the docker pkg has been installed from the wrong apt repo, most probably the default Ubuntu one and not from the official docker repo. If I reinstall docker using their official apt repo I get docker + buildkit.

I am not sure if this is intentional or not but it took me quite a while to narrow this issue down, might be worth fixing.

Here’s a sample bit of config that fixes the issue:

test:
  machine:
    image: ubuntu-2004:202010-01

  environment:
    BUILDKIT_PROGRESS: plain
    DOCKER_BUILDKIT: 1

  steps:
    - run:
      name: Enable Buildkit for Docker
      command: |
        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
        sudo add-apt-repository \
          "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
          $(lsb_release -cs) \
          stable"
        sudo apt-get install docker-ce docker-ce-cli containerd.io -y

This seems to be fixed in later images. I was able to use BuildKit with ubuntu-2004:202104-01.