0

I ran the command sudo rm -rf ~/.local/share/containers/ and now I'm getting,

ERROR: BuildKit is enabled but the buildx component is missing or broken.
       Install the buildx component to build images with BuildKit:
       https://docs.docker.com/go/buildx/

When I try to run docker build how can I resolve this error?

1 Answer 1

0

In my case, the solution was to remove the distro provided docker (which I didn't have -- this is just for safety),

$ for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

Which should do nothing, and didn't for me but that's fine. Then you need to reinstall docker-ce,

apt-get --reinstall install docker-ce

In my case, that didn't work either, because the distro upgrade from one version of Ubuntu to another disabled the docker-ce repo, so I had to re-add that, I just re-ran the commands Docker provides,

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo 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/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Then I ran,

apt-get --reinstall install docker-ce

And it worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.