Transmode / gradle-docker

A Gradle plugin to build Docker images from the build script.
Apache License 2.0
647 stars 142 forks source link

Error when running distDocker on Mac #38

Open sarbogast opened 9 years ago

sarbogast commented 9 years ago

I'm using boot2docker on MacOSX and I was getting this error: Docker execution failed

Command line [docker build -t pixync/pixync-web:latest /Users/sarbogast/dev/pixync-web/build/docker] returned:
time="2015-02-25T11:04:24+01:00" level="fatal" msg="Post http:///var/run/docker.sock/v1.17/build? dockerfile=Dockerfile&rm=1&t=pixync%2Fpixync-web%3Alatest: dial unix /var/run/docker.sock: no such file or directory"

So I added useApi true, but now I'm getting another error:

> org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:2375 refused

I'm a Docker newbie so I'm still lost

sfitts commented 9 years ago

It's been a while since I looked at this, but... I think the most recent versions of boot2docker default to HTTPS for the connection. If that's true then you could try to configure the plug-in to connect over HTTPS (that might work) or failing that configure boot2docker to use HTTP (which I think is possible). Sorry for the vagueness, but hopefully this helps a bit.

bjornmagnusson commented 9 years ago

@sfitts are correct. Try changing hostUrl in docker closure to 'http://localhost:2376'

sarbogast commented 9 years ago

I've just tried adding hostUrl 'https://localhost:2375' to the docker closure but I get the same problem:

Execution failed for task ':distDocker'.
> org.apache.http.conn.HttpHostConnectException: Connection to https://localhost:2375 refused
sarbogast commented 9 years ago

I noticed that I shouldn't use localhost as a host for the API since it's running in a boot2docker VM. So I changed my configuration to the following:

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

I got the IP by running 'boot2docker ip'

But then I got the following error:

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

What should I do to make this work?

sarbogast commented 9 years ago

I managed to work around this issue by running the following image: https://registry.hub.docker.com/u/sequenceiq/socat/

mattgruter commented 9 years ago

@sarbogast thanks for the update. I'll look into it.