-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Closed
Closed
Copy link
Description
At the moment current documentation recommends this approach to configure PodMan:
tasks.named<BootBuildImage>("bootBuildImage") {
docker {
host.set("unix:///run/user/1000/podman/podman.sock")
bindHostToBuilder.set(true)
}
}
Where 1000
is an uid
of a user, which is usually a 1000
, but might be different in some cases.
So, more generic approach to configure PodMan(in theory it's also compatible with Docker) would be:
tasks.named<BootBuildImage>("bootBuildImage") {
docker {
fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 60,
timeoutUnit: TimeUnit = TimeUnit.SECONDS
): String? = runCatching {
ProcessBuilder("\\s".toRegex().split(this))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start().also { it.waitFor(timeoutAmount, timeoutUnit) }
.inputStream.bufferedReader().readText().trim()
}.onFailure { it.printStackTrace() }.getOrNull()
val uid = "id -u".runCommand() ?: 0;
val socketPath = "/run/user/$uid/podman/podman.sock";
if (file(socketPath).exists()) {
host.set("unix://$socketPath")
bindHostToBuilder.set(true)
}
}
}
Which is ugly. It would be nice to move this logic inside of Spring Boot Gradle(and probably maven) plugins to eliminate that boilerplate from configs.
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update