sbt/sbt-native-packager

Support for Podman as Docker alternative

drenizg opened this issue · 0 comments

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:

  • Makes it easy and idiomatic to configure Podman for building (changing dockerExecCommand variable seems a bit hackish)
  • Correctly validates Podman version and its related multistage / chown-flag capabilities (not sure if these validations are needed for Podman).

Information

  • What sbt-native-packager are you using: 1.9.16
  • What sbt version: 1.9.2
  • What is your build system: MacOS Ventura 13.2.1
  • What package are you building: Docker
  • What version has your build tool: using Podman 4.6.1
  • What is your target system (e.g. Ubuntu 16.04, CentOS 7): using a JRE 11 alpine image as base