5

I've got Docker 20.10.21 installed on Ubuntu 23.04. I've also run

export DOCKER_CLI_EXPERIMENTAL=enabled

However, when I run docker buildx, I get

docker: 'buildx' is not a docker command.
See 'docker --help'

I was under the impression that, on Debian-flavored OSes, buildx comes installed with the docker.io package. How do I get this working?

docker version shows

Client:
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.20.1
 Git commit:        20.10.21-0ubuntu3
 Built:             Tue Feb 28 14:28:22 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Engine: Version: 20.10.21 API version: 1.41 (minimum version 1.12) Go version: go1.20.1 Git commit: 20.10.21-0ubuntu3 Built: Tue Feb 28 12:17:52 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.12-0ubuntu3 GitCommit:
runc: Version: 1.1.4-0ubuntu3 GitCommit:
docker-init: Version: 0.19.0 GitCommit:

Daniel W.
  • 251
  • @DanielW.how did you install Docker to begin with? From their repos or from snaps? Or, did you install directly from the Ubuntu repos (which have very outdated versions of Docker) The answer to this will be important. – Thomas Ward May 12 '23 at 02:55
  • I ran apt -y install docker.io. – Daniel W. May 12 '23 at 03:03
  • 1
    that is an ancient version of docker, and because you don't have the Docker repositories set up on your system you will not have a recent version of Docker and other plugin libraries. Follow the instructions at https://docs.docker.com/engine/install/ubuntu/ for setting up their repos for you to get the properly up to date version of Docker and its plugins, then the answers provided by the other users will work. – Thomas Ward May 12 '23 at 03:45
  • I'm pretty sure that this worked previously on 23.04 (I have the image to prove it), but is now broken (I assume due to an update). – Brent Bradburn Sep 14 '23 at 00:31
  • I'm unsure about the specific docker buildx command, but I think that some buildx-related functionality is removed in the upgrade from '20.10.21' to '24.0.x'. – Brent Bradburn Nov 15 '23 at 20:52

3 Answers3

12

If you're encountering the issue with Docker BuildKit and need to install docker-buildx, you can use the following command:

sudo apt install docker-buildx
Trueqap
  • 136
  • Only this is the correct answer to Daniel W.'s OP, done by apt install docker.io, because, as hep put, apt doesn't see any package named docker-buildx-plugin – xpt Dec 29 '23 at 15:53
  • I had to do wsl --shutdown & only then it worked the next time i tried docker build . -t node-app otherwise i was confused why it wouldn't work. – deadcoder0904 Feb 15 '24 at 04:48
3

Make sure you follow the steps described here https://docs.docker.com/engine/install/ and you should be able to install the docker-buildx-plugin

    $ apt-cache policy docker-buildx-plugin
docker-buildx-plugin:
  Installed: 0.10.4-1~ubuntu.20.04~focal
  Candidate: 0.10.4-1~ubuntu.20.04~focal
  Version table:
 *** 0.10.4-1~ubuntu.20.04~focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
        100 /var/lib/dpkg/status
     0.10.2-1~ubuntu.20.04~focal 500
        500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
hairin
  • 31
1

The docker-buildx-plugin package is generally not installed by default. That said, let's check to make sure it's there and, if it's not, get it installed. Here's how:

  1. Open Terminal (if it's not already open)
  2. Check to see if the plugin is installed:
    sudo apt list --installed | grep buildx
    
    If the above command returns nothing, then we've confirmed that the docker-buildx-plugin package is not installed. Continue to the next step.
  3. Install the missing package:
    sudo apt install docker-buildx-plugin
    
  4. Try your docker buildx command again

One thing that I've seen is that an upgrade from one version of Ubuntu to another can also result in this plugin disappearing from Docker's view. Reinstalling just this plugin alone resolves the matter.

matigo
  • 22,138
  • 7
  • 45
  • 75
  • 8
    apt doesn't see any package named docker-buildx-plugin. apt search buildx also shows nothing. – Daniel W. May 12 '23 at 02:18
  • 2
    @DanielW. You have to install docker from their repository: https://docs.docker.com/engine/install/ubuntu/ After that, docker-buildx-plugin will appearch in the search. – user3054986 Sep 12 '23 at 12:32