Search code examples
gradledockerboot2docker

Dockerizing a gradle build on a Mac


I'm trying to dockerize my Gradle build on a Mac by following the advice in this blog post: http://thediscoblog.com/blog/2014/06/13/docker-containers-with-gradle-in-4-steps/ But I'm using Docker on a Mac with boot2docker and it seems to work differently there. I already changed the gradle-docker plugin configuration to be using the Docker API and connect to my Boot2Docker VM:

docker {
    useApi true
    hostUrl 'https://192.168.59.103:2376'
}

I got the IP address by running 'boot2docker ip', but now when I run 'gradle distDocker', I'm getting the following error:

Execution failed for task ':distDocker'.
> javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated

I don't know a lot about Docker yet, and it seems things have changed since the blog post. What should I do to get the plugin working?


Solution

  • From my inexperienced point of view the problem seems to be related with Boot2Docker exposing Docker API with TLS enabled by default. One fast and easy workaround to this is using the image sequenceiq/socat which will expose Docker API in plain HTTP through port 2375.