Transmode / gradle-docker

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

Permission issue with gradle-api? #110

Closed joeyslalom closed 7 years ago

joeyslalom commented 7 years ago

Hello, thanks for the great plugin. I'm currently using it with a simple spring-boot project, and the funny thing is using it is its failing on a new ec2 instance.

$ ./gradlew buildDocker
:compileKotlin UP-TO-DATE
:compileJava UP-TO-DATE
:copyMainKotlinClasses UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestKotlin UP-TO-DATE
:compileTestJava NO-SOURCE
:copyTestKotlinClasses UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
:buildDocker
      [tar] Building tar: /home/ec2-user/spring-booty/build/docker/add_1.tar
:buildDocker FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildDocker'.
> Docker execution failed
  Command line [docker build -t spring-booty:latest /home/ec2-user/spring-booty/build/docker] returned:
  Cannot connect to the Docker daemon. Is the docker daemon running on this host?

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.062 secs

However, if I just call the command line program:

$ docker build -t spring-booty:latest /home/ec2-user/spring-booty/build/docker

Docker can build without any problems. Is there a perhaps a permissions difference between calling the docker build on the command line vs through the gradle-api?

joeyslalom commented 7 years ago

I'm not sure why this worked, but rebooting my instance resolved this =/