bmuschko/gradle-docker-plugin — pull request #6 by edannenberg (2014-06-26 02:11:17+00:00)
Title: Pass docker hostconfig in StartContainer task

This PR enables running of containers with docker hostconfig params. Also adds volumes param to CreateContainer, to enable mounting of host directories.

For mounting host directories into a container the docker api requires the mount config as volumes on creation, as well as binds on container start. Else you end up with a docker volume or nothing depending on which param you ommit.

```groovy
ext.mountConfig = [ "/host/path:/var/www/localhost/htdocs" ]

task createLocalDev(type: DockerCreateContainer) {
imageId = 'foo'
volumes = mountConfig
}

task startLocalDev(type: DockerStartContainer) {
dependsOn createLocalDev
targetContainerId { createLocalDev.getContainerId() }
binds = mountConfig
portBindings = [ [scheme: "tcp", port: "80", hostIp: "127.0.0.1", hostPort: "80" ],
[scheme: "tcp", port: "443", hostIp: "127.0.0.1", hostPort: "443" ]
]
links = [ "some-other-container:db" ]
}
```