sbt / sbt-native-packager

sbt Native Packager
https://sbt-native-packager.readthedocs.io/en/stable/
BSD 2-Clause "Simplified" License
1.59k stars 437 forks source link

Support for Podman as Docker alternative #1552

Open drenizg opened 11 months ago

drenizg commented 11 months ago

Expected behaviour

To be able to use Podman as a valid alternative to Docker, with no warnings

Actual behaviour

Currently, it is possible to successfully use Podman to build container images via setting this in build.sbt:

dockerExecCommand := List("podman")

However, you'll get the following warning:

[warn] [1] sbt-native-packager wasn't able to identify the docker version. Some features may not be enabled
[warn] sbt-native packager tries to parse the `docker version` output. This can fail if
[warn] 
[warn]   - the output has changed:
[warn]     $ docker version --format '{{.Server.APIVersion}}'
[warn] 
[warn]   - no `docker` executable is available
[warn]     $ which docker
[warn] 
[warn]   - you have not the required privileges to run `docker`
[warn] 
[warn] You can display the parsed docker version in the sbt console with:
[warn] 
[warn]   sbt:your-project> show dockerApiVersion
[warn] 
[warn] As a last resort you could hard code the docker version, but it's not recommended!!
[warn] 
[warn]   import com.typesafe.sbt.packager.docker.DockerApiVersion
[warn]   dockerApiVersion := Some(DockerApiVersion(1, 40))
[warn]           

As far as I could get, this is due the fact that the regex used to validate Docker Api version expects versions strings like major.minor, but Podman uses major.minor.patch version style. A possible fix would be to change the regex to acknowledge the difference, but that would render Docker version validations useless for Podman (e.g. to check for multistage or chown-flag capabilities).

So, I was wondering if the community would be interested in having a better support for Podman, that at least:

Information