Fix setting shm size when creating container
MODIFY
src/functTest/groovy/com/bmuschko/gradle/docker/DockerWorkflowFunctionalTest.groovy
src/functTest/groovy/com/bmuschko/gradle/docker/DockerWorkflowFunctionalTest.groovy
@@ -514,6 +514,7 @@ class DockerWorkflowFunctionalTest extends AbstractFunctionalTest {
dependsOn buildImage
targetImageId { buildImage.getImageId() }
containerName = "${uniqueContainerName}"
+ portBindings = ['8080:8080']
shmSize = 128000
cmd = ['/bin/sh']
}
@@ -525,6 +526,9 @@ class DockerWorkflowFunctionalTest extends AbstractFunctionalTest {
if(c.hostConfig.shmSize != 128000) {
throw new GradleException("Invalid ShmSize value!")
}
+ if(!c.hostConfig.portBindings) {
+ throw new GradleException("Invalid port bindings!")
+ }
}
}

MODIFY
src/main/groovy/com/bmuschko/gradle/docker/tasks/container/DockerCreateContainer.groovy
src/main/groovy/com/bmuschko/gradle/docker/tasks/container/DockerCreateContainer.groovy
@@ -345,8 +345,7 @@ class DockerCreateContainer extends AbstractDockerRemoteApiTask {
}
if(getShmSize() != null) { // 0 is valid input
- def hostConfig = threadContextClassLoader.createHostConfig([shmSize: getShmSize()])
- containerCommand.withHostConfig(hostConfig)
+ containerCommand.hostConfig.withShmSize(getShmSize())
}
}

Fix setting shm size when creating container (#480)