GoogleContainerTools / jib

๐Ÿ— Build container images for your Java applications.
Apache License 2.0
13.5k stars 1.42k forks source link

Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.2.1:dockerBuild #4281

Open HackBatTu opened 5 days ago

HackBatTu commented 5 days ago

Environment:

Jib version: 3.2.1 Build tool: Jhipster maven OS: Windowns

Description of the issue:

when i build using maven and jdk installed on my computer : D:\StaffService> mvn -ntp verify -DskipTests -Pprod jib:dockerBuild -q ################################################################################

Thanks for using OpenAPI Generator.

Please consider donation to help us maintain this project ๐Ÿ™

https://opencollective.com/openapi_generator/donate

################################################################################

but when i use maven image on docker maven:3.8.4-jdk-11-slim D:\StaffService>docker run --rm ^ -v %cd%:/usr/src/app/StaffService ^ -v %cd%.devcontainer\settings.xml:/usr/share/maven/conf/settings.xml ^ -w /usr/src/app/StaffService ^ maven:3.8.4-jdk-11-slim ^ mvn verify jib:dockerBuild -ntp -DskipTests -Pprod -q -f pom.xml

################################################################################

Thanks for using OpenAPI Generator.

Please consider donation to help us maintain this project ๐Ÿ™

https://opencollective.com/openapi_generator/donate

################################################################################ [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.2:dockerBuild (default-cli) on project staff-service: Build to Docker daemon failed, perhaps you should make sure Docker is installed and you have correct privileges to run it -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Can someone help me? Please.

chanseokoh commented 5 days ago

jib:dockerBuild is a goal to push an image to a Docker daemon, which means you must be running the Docker daemon somewhere. Obviously, you're running it on your laptop, so it works perfectly fine. However, for the second case, you are running Maven inside a container (which is sort of like a virtual machine), which doesn't run a Docker daemon inside it. Either you should install and run the daemon inside the container, or configure the Docker runtime so that the container can actually see and access the Docker daemon running on your laptop outside the container.