fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 644 forks source link

"DOCKER> unknown flag: --driver" on debian 12.4 "bookworm" amd64 #1739

Closed steinarb closed 10 months ago

steinarb commented 10 months ago

Description

Info

Manually running the command

docker buildx create --driver docker-container --name maven

gives the same error message as the maven build failure

breun commented 10 months ago

My guess is that Docker 20.10.24 is too old to support that --driver flag. You could check the help or man page for your docker command.

The current version of Docker is 24.x: https://docs.docker.com/engine/release-notes

rohanKanojia commented 10 months ago

@steinarb : Could you please check if you face similar issue on newer version of Docker CLI?

breun commented 10 months ago

Hm, I also get that error message with the latest version:

❯ docker --version
Docker version 24.0.7, build e7ce1f3
❯ docker buildx create --driver docker-container --name maven
unknown flag: --driver
See 'docker --help'.
(...)
rohanKanojia commented 10 months ago

@breun : Do you have some simple reproducer project on which I can try it out?

breun commented 10 months ago

I don't, but @steinarb included a link to a sample project in the original post. I just tried running the docker command that was run to see if it was at least accepted syntax.

steinarb commented 10 months ago

@breun : Do you have some simple reproducer project on which I can try it out?

There is one in the Description of this issue:

git clone https://github.com/steinarb/sonar-collector.git
cd sonar-collector
git checkout use-karaf-444-in-docker
mvn install
cd docker
mvn install

The config in sonar-collector/docker/pom.xml is probably not working, but it doesn't look like it gets far enough to fail because the docker-maven-plugin sends in a flag docker doesn't like (at least the docker native on current debian stable (12.4 "bookworkm") doesn't understand it. And I would really prefer things to work with that docker).

rohanKanojia commented 10 months ago

@steinarb : hello, I tried reproducing this issue by cloning your project and following the steps but I couldn't reproduce it. I am using Fedora 39 at the moment.

I even tried reproducing this issue via GitHub actions )it seems to use Ubuntu 22) but still no luck.

steinarb commented 10 months ago

Yes, as someone said in a comment over: the docker of debian 12.4 is probably too old (docker 20 while current is 24).

Running the command line command manually gives the same error.

It's still docker 20.x in debian unstable and nothing newer in backports: https://packages.debian.org/sid/docker.io

So I guess this docker-maven-plugin will not work for me (if I can't use the docker provided by debian it will be too much work).

steinarb commented 10 months ago

Hm... there is an APT repo appropriate for use on debian 12 https://docs.docker.com/engine/install/debian/

breun commented 10 months ago

Yes, as someone said in a comment over: the docker of debian 12.4 is probably too old (docker 20 while current is 24).

I said that, but I also confirmed that the flag doesn’t exist on the current latest version, so apparently that theory was incorrect.

breun commented 10 months ago

@rohanKanojia If you run the commands from https://github.com/fabric8io/docker-maven-plugin/issues/1739#issuecomment-1870165875, do you not get that error saying unknown flag: --driver?

steinarb commented 10 months ago

Nils Breunese @.***>:

Yes, as someone said in a comment over: the docker of debian 12.4 is probably too old (docker 20 while current is 24). I said that, but I also confirmed that the flag doesn’t exist on the current latest version, so apparently that theory was incorrect.

Yes, I saw that too.

But I got confused as to what was right and figured I was just stuck with a too old docker.

rohanKanojia commented 10 months ago

@steinarb : Do you need to rely on buildkit features? If not, you can disable it via DOCKER_BUILDKIT=0 environment variable.

@breun : When I run above commands I see this output:

~ : $ docker --version
Docker version 24.0.7, build afdd53b
~ : $ docker buildx cdocker buildx create --driver docker-container --name maven
maven
steinarb commented 10 months ago

Rohan Kumar @.***>:

@steinarb : Do you need to rely on buildkit features? If not, you can disable it via DOCKER_BUILDKIT=0 environment variable.

I don't know. My docker image build requirements are pretty humble, so probably not.

I tried disabling DOCKER_BUILDKIT but I get the same error as before: https://gist.github.com/steinarb/5e6ca961c51d044368b95cabf4fafe42

rohanKanojia commented 10 months ago

@steinarb : To make plugin not rely on docker CLI (which it does for buildx), you would need to remove <platform > from <buildx> configuration, or maybe just remove whole <buildx> configuration section.

steinarb commented 10 months ago

Ok, removing worked a lot better: https://gist.github.com/steinarb/3bb38f8df9082db7246a3192585600d6

There is still the issue of docker pulling a wrong architecture image (arm64 instead of amd64) which is the same problem I had with the old, discontinued, docker-maven-plugin from spotify.

But that is probably an issue with the official karaf image. I will investigate with the karaf project.

Here is the branch with the pushed changes: https://github.com/steinarb/sonar-collector/tree/use-karaf-444-in-docker

Thanks! Closing this as fixed/no error.