Open maheshshelke33821 opened 1 year ago
bump. Having this issue as well
Kicking over docker resolved it for me:
sudo systemctl stop docker
# Verify
sudo systemctl status docker
sudo systemctl start docker
Build worked fine from that point onwards. Not certain what cause Docker to be unhappy.
Description
I'm able to run gradle build command locally and it is a success. But when I use gradle build inside Dockerfile i'm not able to build an image out of it.
it gives error:
0 2.983
0 2.983 FAILURE: Build failed with an exception.
0 2.983
0 2.983 * Where:
0 2.983 Build file '/home/gradle/src/build.gradle' line: 2
0 2.983
0 2.983 * What went wrong:
0 2.983 Plugin [id: 'org.springframework.boot', version: '2.1.4.RELEASE'] was not found in any of the following sources:
0 2.983
0 2.983 - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
0 2.983 - Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.1.4.RELEASE')
0 2.983 Searched in the following repositories:
0 2.983 Gradle Central Plugin Repository
0 2.983
0 2.983 * Try:
0 2.983 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.
0 2.984
0 2.984 * Get more help at https://help.gradle.org
0 2.984
0 2.984 BUILD FAILED in 2s
here is my build.gradle file plugins { id 'org.springframework.boot' version '2.1.4.RELEASE' id 'java' }
apply plugin: 'io.spring.dependency-management'
group = 'io.codefresh' version = '0.0.1-SNAPSHOT' sourceCompatibility = '1.8'
repositories { mavenCentral() }
dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' }
test { useJUnit()
}
Reproduce
Dockerfile FROM gradle:4.7.0-jdk8-alpine AS build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src RUN gradle build --no-daemon FROM openjdk:8-jre-slim EXPOSE 8080 RUN mkdir /app COPY --from=build /home/gradle/src/build/libs/*.jar /app/spring-boot-application.jar ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-Djava.security.egd=file:/dev/./urandom","-jar","/app/spring-boot-application.jar"]
build.gradle plugins { id 'org.springframework.boot' version '2.1.4.RELEASE' id 'java' } apply plugin: 'io.spring.dependency-management group = 'io.codefresh' version = '0.0.1-SNAPSHOT' sourceCompatibility = '1.8' repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' } test { useJUnit() maxHeapSize = '1G' }
On Running docker build . we get error
Expected behavior
should build successfully and create image
docker version
docker info
Diagnostics ID
BE5AB60B-1C8B-45D7-A8FC-18FE8A5C686D/20230807141601
Additional Info
Here is the link for repository: https://github.com/codefresh-contrib/gradle-sample-app