4

I'm running

  • Ubuntu 20.04.5 LTS
  • Docker version 23.0.1, build a5ee5b1

Running the command

docker build -t some:other Dockerfile

Produces the following output:

unknown shorthand flag: 't' in -t

And

docker build

The following:

docker: 'buildx' is not a docker command.

I installed Docker as recommended from the repo: instructions

Other plugins don't work either (docker compose is not recognized either). Even then, docker info shows

  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.2
    Path:     /home/jpartanen/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.16.0
    Path:     /home/jpartanen/.docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)

Docker runs without sudo with the help of the docker user group, as explained in linux-postinstall. I want to run plugins without sudo as well.

I've reinstalled Docker and rebooted the machine without any change. What could be the problem?

Lupilum
  • 363
  • 2
  • 11

1 Answers1

2

Make the plugins runnable for docker by creating a link:

ln -s /usr/libexec/docker/cli-plugins/ ~/.docker/cli-plugins

The command not being recognized by Docker is extra confusing because of the mismatch in commands, build vs buildx. This is because Docker Engine 23.0 set Buildx and BuildKit as the default builder on Linux. docker build is aliased to docker buildx build.

As for running without sudo, the problem is possibly caused by the plugins being installed in the wrong place. On my machine, running the command

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

installs the plugins in /usr/libexec/docker/cli-plugins/, whereas as laid out here, the plugins are usable from $HOME/.docker/cli-plugins (without sudoing).

A somewhat robust solution is to create a link as laid out above.

Lupilum
  • 363
  • 2
  • 11