New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker for mac 1.12 cannot connect #235

Closed
bitsofinfo opened this Issue Jul 3, 2016 · 18 comments

Comments

Projects
None yet
10 participants
@bitsofinfo

bitsofinfo commented Jul 3, 2016

Getting this.

Tried setting DOCKER_HOST to the docker socket but this gradle task still doesn't work

[dockerjava-jaxrs-async-0] ERROR com.github.dockerjava.core.async.ResultCallbackTemplate - Error during callback
org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
        at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
        at com.github.dockerjava.jaxrs.connector.ApacheConnector.apply(ApacheConnector.java:437)

If i try

docker {
    url = "unix:///var/run/docker.sock"
}

I get

java.lang.UnsatisfiedLinkError: Could not find library in classpath, tried: [libjunixsocket-macosx-1.8-x86_64.dylib, libjunixsocket-macosx-1.5-x86_64.dylib]
        at org.newsclub.net.unix.NativeUnixSocket.load(NativeUnixSocket.java:81)
        at org.newsclub.net.unix.NativeUnixSocket.<clinit>(NativeUnixSocket.java:112)
        at org.newsclub.net.unix.AFUNIXSocket.<init>(AFUNIXSocket.java:36)
        at org.newsclub.net.unix.AFUNIXSocket.newInstance(AFUNIXSocket.java:50)
        at com.github.dockerjava.jaxrs.ApacheUnixSocket.<init>(ApacheUnixSocket.java:51)
        at com.github.dockerjava.jaxrs.UnixConnectionSocketFactory.createSocket(UnixConnectionSocketFactory.java:65)
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:118)
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)

? https://forums.docker.com/t/worked-around-docker-http-s-api-no-longer-available-in-beta9/10474/6

docker-java/docker-java#537

@bitsofinfo

This comment has been minimized.

Show comment
Hide comment
@bitsofinfo

bitsofinfo Jul 3, 2016

This definitely aids the issue

brew install socat
nohup socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock &

or /var/tmp/docker.sock (depends on your local setup)

bitsofinfo commented Jul 3, 2016

This definitely aids the issue

brew install socat
nohup socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock &

or /var/tmp/docker.sock (depends on your local setup)

@cdancy

This comment has been minimized.

Show comment
Hide comment
@cdancy

cdancy Jul 4, 2016

Collaborator

@bitsofinfo this is definitely a known issue and the link to the docker-forum, and subsequently the docker-devs themselves, suggest that a "tcp fix" may not be forthcoming at all. Not sure what to make of that. The fix, as you note, does work as expected! Being a mac user myself I greatly appreciate you sharing this!

However, I've stumbled upon a few issues related to docker-on-mac being on v1.24 of their API and docker-java not yet supporting this. Trying to set the apiVersion to 1.23, 1.22, 1.21 still was throwing exceptions. I've commented on an open issue they have already which is similar. Lets see what they have to say.

Collaborator

cdancy commented Jul 4, 2016

@bitsofinfo this is definitely a known issue and the link to the docker-forum, and subsequently the docker-devs themselves, suggest that a "tcp fix" may not be forthcoming at all. Not sure what to make of that. The fix, as you note, does work as expected! Being a mac user myself I greatly appreciate you sharing this!

However, I've stumbled upon a few issues related to docker-on-mac being on v1.24 of their API and docker-java not yet supporting this. Trying to set the apiVersion to 1.23, 1.22, 1.21 still was throwing exceptions. I've commented on an open issue they have already which is similar. Lets see what they have to say.

@cdancy cdancy added the bug label Jul 4, 2016

@cdancy cdancy self-assigned this Jul 4, 2016

@bitsofinfo

This comment has been minimized.

Show comment
Hide comment
@bitsofinfo

bitsofinfo commented Jul 4, 2016

related #231 ?

@cdancy

This comment has been minimized.

Show comment
Hide comment
@cdancy

cdancy Jul 4, 2016

Collaborator

Somewhat related but that is more ties to using Unix sockets than going over tcp. If we can get tcp working OOTB that would be the preferred solution and one we could move forward with instead of waiting on all the work that needs to be done to get Unix sockets on Mac working as expected.

Collaborator

cdancy commented Jul 4, 2016

Somewhat related but that is more ties to using Unix sockets than going over tcp. If we can get tcp working OOTB that would be the preferred solution and one we could move forward with instead of waiting on all the work that needs to be done to get Unix sockets on Mac working as expected.

@double16

This comment has been minimized.

Show comment
Hide comment
@double16

double16 Jul 4, 2016

Contributor

I had Docker for Mac 1.11 working using this recipe:

dependencies {
    dockerJava 'com.github.docker-java:docker-java:3.0.0'
    dockerJava 'com.kohlschutter.junixsocket:junixsocket-common:2.0.4' // for gradle-docker-plugin using Unix sockets
    dockerJava 'com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4' // for gradle-docker-plugin using Unix sockets
    dockerJava 'org.slf4j:slf4j-simple:1.7.5'
    dockerJava 'cglib:cglib:3.2.0'
}

docker {
  url = "unix:///var/run/docker.sock"
}

Docker for Mac 1.12 broke with the server API compatibility. At which point I uninstalled and am using docker-machine exclusively.

Contributor

double16 commented Jul 4, 2016

I had Docker for Mac 1.11 working using this recipe:

dependencies {
    dockerJava 'com.github.docker-java:docker-java:3.0.0'
    dockerJava 'com.kohlschutter.junixsocket:junixsocket-common:2.0.4' // for gradle-docker-plugin using Unix sockets
    dockerJava 'com.kohlschutter.junixsocket:junixsocket-native-common:2.0.4' // for gradle-docker-plugin using Unix sockets
    dockerJava 'org.slf4j:slf4j-simple:1.7.5'
    dockerJava 'cglib:cglib:3.2.0'
}

docker {
  url = "unix:///var/run/docker.sock"
}

Docker for Mac 1.12 broke with the server API compatibility. At which point I uninstalled and am using docker-machine exclusively.

@tclift

This comment has been minimized.

Show comment
Hide comment
@tclift

tclift Aug 16, 2016

Force upgrading Docker Java's unix-socket-factory dependency worked for me. Using Docker for Mac 1.12.0-a (stable) and docker-java-application 3.0.2.

configurations {
    dockerJava {
        resolutionStrategy {
            force 'de.gesellix:unix-socket-factory:2016-04-06T22-21-19'
        }
    }
}

docker {
  url = 'unix:///var/run/docker.sock'
}

tclift commented Aug 16, 2016

Force upgrading Docker Java's unix-socket-factory dependency worked for me. Using Docker for Mac 1.12.0-a (stable) and docker-java-application 3.0.2.

configurations {
    dockerJava {
        resolutionStrategy {
            force 'de.gesellix:unix-socket-factory:2016-04-06T22-21-19'
        }
    }
}

docker {
  url = 'unix:///var/run/docker.sock'
}
@childnode

This comment has been minimized.

Show comment
Hide comment
@childnode
Contributor

childnode commented Aug 16, 2016

@gesellix

This comment has been minimized.

Show comment
Hide comment
@gesellix

gesellix Aug 16, 2016

The docker-java lib depends on unix-socket-factory, which is actually the one depending on the relevant com.kohlschutter.junixsocket:junixsocket* libs.
Beware of Netty, though, as mentioned here: docker-java/docker-java#537 (comment)

gesellix commented Aug 16, 2016

The docker-java lib depends on unix-socket-factory, which is actually the one depending on the relevant com.kohlschutter.junixsocket:junixsocket* libs.
Beware of Netty, though, as mentioned here: docker-java/docker-java#537 (comment)

@priyadarsh

This comment has been minimized.

Show comment
Hide comment
@priyadarsh

priyadarsh Nov 1, 2016

@tclift
I tried your suggestion and it led me to another exception. I tried running as sudo as well.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':buildImage'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:45)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: net.sf.cglib.proxy.UndeclaredThrowableException: java.lang.reflect.InvocationTargetException-->null
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$3c8bede6.awaitImageId(<generated>)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$3c8bede6$awaitImageId.call(Unknown Source)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$20a8d4c6$awaitImageId.call(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.image.DockerBuildImage.runRemoteCommand(DockerBuildImage.groovy:119)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask$_start_closure1.doCall(AbstractDockerRemoteApiTask.groovy:48)
        at com.bmuschko.gradle.docker.utils.DockerThreadContextClassLoader.withClasspath(DockerThreadContextClassLoader.groovy:43)
        at com.bmuschko.gradle.docker.utils.ThreadContextClassLoader$withClasspath.call(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask.runInDockerClassPath(AbstractDockerRemoteApiTask.groovy:53)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask$runInDockerClassPath.callCurrent(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask.start(AbstractDockerRemoteApiTask.groovy:47)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 68 more
Caused by: java.lang.reflect.InvocationTargetException
        at java_lang_reflect_Method$invoke.call(Unknown Source)
        at java_lang_reflect_Method$invoke.call(Unknown Source)
        at com.bmuschko.gradle.docker.utils.DockerThreadContextClassLoader$_createPrintStreamProxyCallback_closure8.doCall(DockerThreadContextClassLoader.groovy:354)
        at com.sun.proxy.$Proxy373.invoke(Unknown Source)
        ... 86 more
Caused by: com.github.dockerjava.api.DockerClientException: Could not build image: unauthorized: authentication required
        at com.github.dockerjava.core.command.BuildImageResultCallback.getImageId(BuildImageResultCallback.java:71)
        at com.github.dockerjava.core.command.BuildImageResultCallback.awaitImageId(BuildImageResultCallback.java:48)
        ... 90 more

priyadarsh commented Nov 1, 2016

@tclift
I tried your suggestion and it led me to another exception. I tried running as sudo as well.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':buildImage'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:45)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: net.sf.cglib.proxy.UndeclaredThrowableException: java.lang.reflect.InvocationTargetException-->null
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$3c8bede6.awaitImageId(<generated>)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$3c8bede6$awaitImageId.call(Unknown Source)
        at com.github.dockerjava.core.command.BuildImageResultCallback$$EnhancerByCGLIB$$20a8d4c6$awaitImageId.call(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.image.DockerBuildImage.runRemoteCommand(DockerBuildImage.groovy:119)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask$_start_closure1.doCall(AbstractDockerRemoteApiTask.groovy:48)
        at com.bmuschko.gradle.docker.utils.DockerThreadContextClassLoader.withClasspath(DockerThreadContextClassLoader.groovy:43)
        at com.bmuschko.gradle.docker.utils.ThreadContextClassLoader$withClasspath.call(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask.runInDockerClassPath(AbstractDockerRemoteApiTask.groovy:53)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask$runInDockerClassPath.callCurrent(Unknown Source)
        at com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask.start(AbstractDockerRemoteApiTask.groovy:47)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 68 more
Caused by: java.lang.reflect.InvocationTargetException
        at java_lang_reflect_Method$invoke.call(Unknown Source)
        at java_lang_reflect_Method$invoke.call(Unknown Source)
        at com.bmuschko.gradle.docker.utils.DockerThreadContextClassLoader$_createPrintStreamProxyCallback_closure8.doCall(DockerThreadContextClassLoader.groovy:354)
        at com.sun.proxy.$Proxy373.invoke(Unknown Source)
        ... 86 more
Caused by: com.github.dockerjava.api.DockerClientException: Could not build image: unauthorized: authentication required
        at com.github.dockerjava.core.command.BuildImageResultCallback.getImageId(BuildImageResultCallback.java:71)
        at com.github.dockerjava.core.command.BuildImageResultCallback.awaitImageId(BuildImageResultCallback.java:48)
        ... 90 more
@gesellix

This comment has been minimized.

Show comment
Hide comment
@gesellix

gesellix Nov 1, 2016

the relevant bit is probably this one:

Caused by: com.github.dockerjava.api.DockerClientException: Could not build image: unauthorized: authentication required

You need to configure the registry credentials.

gesellix commented Nov 1, 2016

the relevant bit is probably this one:

Caused by: com.github.dockerjava.api.DockerClientException: Could not build image: unauthorized: authentication required

You need to configure the registry credentials.

@priyadarsh

This comment has been minimized.

Show comment
Hide comment
@priyadarsh

priyadarsh Nov 1, 2016

Yes I did.

docker {
  url = 'unix:///var/run/docker.sock'
  registryCredentials {
    url = dockerRegistryUrl
    username = dockerRegistryUser
    password = dockerRegistryPass
    email = dockerRegistryEmail
  }
}

and also executed docker login before running build.

priyadarsh commented Nov 1, 2016

Yes I did.

docker {
  url = 'unix:///var/run/docker.sock'
  registryCredentials {
    url = dockerRegistryUrl
    username = dockerRegistryUser
    password = dockerRegistryPass
    email = dockerRegistryEmail
  }
}

and also executed docker login before running build.

@rafaroca

This comment has been minimized.

Show comment
Hide comment
@rafaroca

rafaroca Nov 7, 2016

To me, docker-java-3.0.6 fixed this issue.
I see that the master branch of gradle-docker-plugin already contains 3.0.6
Is there a new release possible/planned even though this would just contain the version bump of docker-java?

rafaroca commented Nov 7, 2016

To me, docker-java-3.0.6 fixed this issue.
I see that the master branch of gradle-docker-plugin already contains 3.0.6
Is there a new release possible/planned even though this would just contain the version bump of docker-java?

@cdancy

This comment has been minimized.

Show comment
Hide comment
@cdancy

cdancy Nov 7, 2016

Collaborator

@rafaroca some bits do indeed work but not all. The owner/maintainer of docker-java has been working on proper osx support but is not yet ready.

I can certainly release a new version if it will help with your workload.

Collaborator

cdancy commented Nov 7, 2016

@rafaroca some bits do indeed work but not all. The owner/maintainer of docker-java has been working on proper osx support but is not yet ready.

I can certainly release a new version if it will help with your workload.

@rafaroca

This comment has been minimized.

Show comment
Hide comment
@rafaroca

rafaroca Nov 8, 2016

@cdancy I just tested my use case again. Some parts are indeed not working. My gradle build starts but has issues. Appreciate your offer but I realize that a new version would not help here.

rafaroca commented Nov 8, 2016

@cdancy I just tested my use case again. Some parts are indeed not working. My gradle build starts but has issues. Appreciate your offer but I realize that a new version would not help here.

@hsyed

This comment has been minimized.

Show comment
Hide comment
@hsyed

hsyed Nov 26, 2016

Had to do this to get it working.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 2375:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock

hsyed commented Nov 26, 2016

Had to do this to get it working.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 2375:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock

@Alxandr

This comment has been minimized.

Show comment
Hide comment
@Alxandr

Alxandr Nov 29, 2016

With docker-machine I have the following working:

docker {
      url = System.getenv('DOCKER_HOST')
      certPath = new File(System.getenv('DOCKER_CERT_PATH'))
}

It seems to me that this should maybe be default behaviour?

Alxandr commented Nov 29, 2016

With docker-machine I have the following working:

docker {
      url = System.getenv('DOCKER_HOST')
      certPath = new File(System.getenv('DOCKER_CERT_PATH'))
}

It seems to me that this should maybe be default behaviour?

@cdancy

This comment has been minimized.

Show comment
Hide comment
@cdancy

cdancy Nov 29, 2016

Collaborator

@Alxandr that is more for a general use-case and not really relevant to the topic at hand.

Collaborator

cdancy commented Nov 29, 2016

@Alxandr that is more for a general use-case and not really relevant to the topic at hand.

@cdancy

This comment has been minimized.

Show comment
Hide comment
@cdancy

cdancy Dec 13, 2016

Collaborator

Closing issue for now as I use docker on mac on a daily basis and cannot reproduce the OP's ISSUE (at least not with the latest plugin and latest docker-on-mac). Setting docker.url to unix:///var/run/docker.sock is working as expected.

Collaborator

cdancy commented Dec 13, 2016

Closing issue for now as I use docker on mac on a daily basis and cannot reproduce the OP's ISSUE (at least not with the latest plugin and latest docker-on-mac). Setting docker.url to unix:///var/run/docker.sock is working as expected.

@cdancy cdancy closed this Dec 13, 2016

lanwen added a commit to lanwen/nebula-docker-plugin that referenced this issue Jan 16, 2017

update docker-gradle-plugin to 3.0.5
This updates docker-java dependency, which contains fix for bmuschko/gradle-docker-plugin#235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment