Skip to content

Commit

Permalink
Docker run bugfix / DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Jan 20, 2022
1 parent 96f00c7 commit 8a35904
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ open class DockerRunSpec(docker: Docker) : DockerInvokeSpec(docker) {
commandLine.set(environment.obj.provider {
mutableListOf<String>().apply {
add("run")
addAll((mutableListOf<String>().apply {
name.orNull?.let { addAll(listOf("--name", it)) }
if (autoRemove.get()) add("--rm")
if (detached.get()) add("-d")
} + options.get()).toSet())
name.orNull?.let { addAll(listOf("--name", it)) }
if (autoRemove.get() && !options.get().contains("--rm")) add("--rm")
if (detached.get() && !options.get().contains("-d")) add("-d")
addAll(options.get())
addAll(volumes.get().map { (localPath, containerPath) -> "-v=${runtime.determinePath(localPath)}:$containerPath" })
addAll(ports.get().map { (hostPort, containerPort) -> "-p=$hostPort:$containerPort" })
add(imageOrFail)
Expand Down

0 comments on commit 8a35904

Please sign in to comment.