How to install buildx with docker 23.0.1
Asked Answered
P

6

12

I am trying to install buildx from docker doc. At first, I tried Install using a Dckerfile. I have to say, I have no clue how to install it with this steps, the instructions is very poor for this section. So I pick option Download manually.

I downloaded buildx-v0.10.2.darwin-amd64 binary, copy it to $HOME/.docker/cli-plugins and rename it as docker-buildx and make it executable:

$ ll $HOME/.docker/cli-plugins/docker-buildx
-rwxr-xr-x 1 root root 55984928 Feb 14 20:05 /root/.docker/cli-plugins/docker-buildx*

All this steps are from documentation.

As next step, I wanted to Set Buildx as the default builder. According to the docs, I shuld run docker buildx install but it raised and exception 'buildx' is not a docker command:

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

The instructions are very unclear to me and dont know how to fix it. I found this but its basically the same steps so its do not help.

Can anybody help me to find out, whats I am missing?

$ uname -m
x86_64

Docker version 23.0.1, build a5ee5b1

Pluralism answered 14/2, 2023 at 19:37 Comment(1)
Are you running docker, and not a competing project like podman? Docker includes buildx out of the box.Spindling
P
12

On Debian you can install plugin package (see official install instructions):

apt install docker-buildx-plugin

similar on RedHat/CentOS:

yum install docker-buildx-plugin

then run:

docker buildx install

or update /etc/docker/daemon.json with (and restart docker service):

{
  "features": {
    "buildkit" : true
  }
}

Then docker info should be showing something like this:

$ docker info | head -n8
Client: Docker Engine - Community
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
Patriarchy answered 25/10, 2023 at 12:0 Comment(0)
W
9

I had to simply do sudo apt install docker-buildx & then did wsl --shutdown.

After that, I tried docker build . -t node-app which worked without showing the error:

DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/buildx/

Werner answered 15/2 at 4:53 Comment(0)
C
1

Try this.

  1. Download buildx-v0.10.2.darwin-amd64 to $HOME/.docker/cli-plugins
  2. Don't rename it
  3. Run the following command: $ docker buildx install

See if it works.

Creole answered 25/8, 2023 at 21:2 Comment(0)
W
0

Docker Engine package repositories contain Docker Buildx packages when installed according to the Docker Engine install documentation. Install the docker-buildx-plugin package to install the Buildx plugin.

Still if you want to Manual download then follow below steps

  • Download buildx binary from below URL as per your OS architecture :

    https://github.com/docker/buildx/releases/

  • Rename the binary to docker-buildx

  • Place the binary in the below path : $HOME/.docker/cli-plugins

  • Set the environment path and source the file

Source:

https://github.com/docker/buildx#installing


Commands logs:

$ docker buildx version
    github.com/docker/buildx v0.10.5 86bdced7766639d56baa4c7c449a4f64684787

$ docker info 
Client:
 Version:    24.0.2-rd
 Context:    default
 Debug Mode: false
 -----
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.5
    Path:     /Users/Shubh/.docker/cli-plugins/docker-buildx
 -----
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /Users/Shubh/.docker/cli-plugins/docker-compose
 
Wherewithal answered 6/9, 2023 at 9:16 Comment(0)
D
0

I struggled badly to install docker buildx and finally got a reliable way.

This approach addresses the following,

  1. Install docker buildx for any user
  2. Installation on any distribution manually
  3. Convenient way to install buildx in a remote machine

Installation:

  • SSH to the remote machine and switch to root user
    ❯ sudo -i
  • Identify your linux architecture from client Docker version command
    ❯ docker version
    Client:
     Version:           20.10.17
     API version:       1.41
     Go version:        go1.17.11
     Git commit:        100c701
     Built:             Mon Jun  6 22:59:14 2022
     OS/Arch:           linux/arm64
     Context:           default
     Experimental:      true
    ...
    ...
  • Download the docker buildx binary of your linux arch, which is compatible to the installed Docker (Refer dependency changes under release page for compatible Docker)
    ❯ wget -nv https://github.com/docker/buildx/releases/download/v0.8.2/buildx-v0.8.2.linux-arm64
  • Create the cli-plugins folder. Replace <user> with your user, where buildx is required.
    ❯ mkdir -p /home/<user>/.docker/cli-plugins
  • Move the binary. Don't forget to rename the binary to docker-buildx like following, (It is a mandatory step)
    ❯ mv buildx-v0.8.2.linux-arm64 /home/<user>/.docker/cli-plugins/docker-buildx
  • Make the binary executable
    ❯ chmod a+x /home/<user>/.docker/cli-plugins/docker-buildx
  • Give ownership from root to your user
    ❯ chown -v -R <user> /home/<user>
  • Confirm the Docker buildx installation with Docker info command.
    ❯ docker info | head -n7
    Client:
     Context:    default
     Debug Mode: false
     Plugins:
      buildx: Docker Buildx (Docker Inc., v0.8.2)
      compose: Docker Compose (Docker Inc., v2.5.1)
    ❯
Dulce answered 2/6 at 7:54 Comment(0)
D
-1

first execute

~/.docker/cli-plugins/docker-buildx

and see if you can execute it. if it is not executable then docker buildx install will fail

Duckett answered 17/2, 2023 at 4:32 Comment(2)
This is not a solution, just a check. Is the solution to make it executable?Heighho
@Heighho if the binary is not executable, you will need to use chmod to make it executable. Then docker buildx install will work. It is not a check, it is a proper solution.Duckett

© 2022 - 2024 — McMap. All rights reserved.