title: Can't build gradle application inside docker
body: <p>I am trying to build an application with gradle from within a docker container.
  This is my Dockerfile:</p>
  
  <pre><code>FROM openjdk:8-jdk
  #install git
  RUN apt-get install -y git
  RUN git clone https://github.com/SFRJ/yurl.git
  #install gradle
  RUN wget https://downloads.gradle-dn.com/distributions/gradle-6.5-bin.zip
  RUN unzip gradle-6.5-bin.zip
  ENV GRADLE_HOME /gradle-6.5
  ENV PATH $PATH:/gradle-6.5/bin
  #compile and run app
  RUN cd yurl
  RUN gradle clean build --rerun-tasks --no-build-cache
  ENTRYPOINT ["java", "-jar", "/yurlapp.jar"]
  </code></pre>
  
  <p>Everything goes well until the point where the build command is executed. It throws the following:</p>
  
  <pre><code>Step 9/10 : RUN gradle clean build --rerun-tasks --no-build-cache
   ---&gt; Running in a25d344c3571
  
  Welcome to Gradle 6.5!
  
  Here are the highlights of this release:
   - Experimental file-system watching
   - Improved version ordering
   - New samples
  
  For more details see https://docs.gradle.org/6.5/release-notes.html
  
  Starting a Gradle Daemon (subsequent builds will be faster)
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring root project ''.
  &gt; The project name must not be empty. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/6.5/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 3s
  ERROR: Service 'yurlapp' failed to build: The command '/bin/sh -c gradle clean build --rerun-tasks --no-build-cache' returned a non-zero code: 1
  </code></pre>
  
  <p>I just don't understand what it is. The app builds perfectly fine when I run the same command outside of docker but inside docker fails. This is not a multi module project not sure why it complains about rootProject.</p>
  
  <p>I can confirm that I have a settings.gradle file and inside I have this</p>
  
  <pre><code>rootProject.name = 'yurl'
  </code></pre>
  
  <p>Also this is my build.gradle</p>
  
  <pre><code>buildscript {
      repositories {
          mavenLocal()
          mavenCentral()
      }
      dependencies {
          classpath "org.postgresql:postgresql:42.2.11"
      }
  }
  
  plugins {
      id 'org.springframework.boot' version '2.2.4.RELEASE'
      id 'io.spring.dependency-management' version '1.0.9.RELEASE'
      id 'java'
      id 'org.flywaydb.flyway' version '6.3.0'
      id 'nu.studer.jooq' version '4.1'
  }
  
  group 'com.javing.yurl'
  version '1.0-SNAPSHOT'
  
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
  
      annotationProcessor 'org.projectlombok:lombok:1.18.8'
  
      implementation 'org.jooq:jooq'
      implementation 'org.jooq:jooq-codegen'
      jooqRuntime 'org.postgresql:postgresql:42.2.11'
      compile 'org.postgresql:postgresql:42.2.11'
      implementation 'org.projectlombok:lombok:1.18.8'
      implementation 'org.springframework.boot:spring-boot-starter-web'
      implementation 'org.springframework.boot:spring-boot-starter-actuator'
      implementation 'org.springframework.boot:spring-boot-starter-jooq'
      implementation 'io.vavr:vavr:0.10.2'
      implementation 'com.konghq:unirest-java:3.7.00'
  
      testCompile group: 'junit', name: 'junit', version: '4.12'
      testCompile group: 'org.mockito', name: 'mockito-core', version: '2.1.0'
      testCompile group: 'org.assertj', name: 'assertj-core', version: '3.15.0'
  
  }
  
  jooq {
      sample(sourceSets.main) {
          jdbc {
              driver = 'org.postgresql.Driver'
              url = 'jdbc:postgresql://yurldb:5432/yurldb'
              user = 'postgres'
              password = 'somepassword'
          }
          generator {
              database() {
                  name = 'org.jooq.meta.postgres.PostgresDatabase'
                  inputSchema = 'public'
                  includes = '.*'
              }
              target {
                  packageName = 'com.javing.yurl'
                  directory = 'build/generated/java'
              }
          }
      }
  }
  
  tasks.generateSampleJooqSchemaSource.with {
      def out = new ByteArrayOutputStream()
      javaExecSpec = { JavaExecSpec s -&gt;
          s.standardOutput = out
          s.errorOutput = out
          s.ignoreExitValue = true
          s.jvmArgs '-Xmx512M'
      }
      execResultHandler = { ExecResult r -&gt;
          if (r.exitValue != 0) {
              throw new RuntimeException('jOOQ source code generation failed:\n\n' + out.toString())
          }
      }
  }
  
  flyway {
      url = 'jdbc:postgresql://localhost:5432/yurldb'
      user = 'postgres'
      password = 'somepassword'
      schemas = ['public']
      locations = ["filesystem:$project.projectDir/src/main/resources/db/migration"]
  }
  </code></pre>
  
  <p>I don't know how to fix this I tried multiple things but nothing worked. I need to build this app from within docker using gradle. I know gradle is installed correctly because if I add the version command (<strong><em>RUN gradle -v</em></strong>) in the Dockerfile, I can see this printed when docker is running:</p>
  
  <pre><code>------------------------------------------------------------
  Gradle 6.5
  ------------------------------------------------------------
  
  Build time:   2020-06-02 20:46:21 UTC
  Revision:     a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
  
  Kotlin:       1.3.72
  Groovy:       2.5.11
  Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
  JVM:          1.8.0_252 (Oracle Corporation 25.252-b09)
  OS:           Linux 4.18.0-25-generic amd64
  </code></pre>
  
  <p>So my gradle and configuration of gradle seems ok. Also I know the installation of git and the clonning of the project is fine because if I add a <strong><em>RUN ls -s</em></strong> in my Dockerfile it will correctly print all the content of the project. </p>
  
  <p>Something is wrong maybe in the build.gradle or settings.gradle file. Any idea what could be?</p>