能否仅使用GoogleContainerTools/jib构建镜像,而非部署至云端或DockerHub?
Absolutely! You can totally use Jib to build container images without pushing them to any remote registry (like Docker Hub or cloud-based registries). Here’s how to do it with the two most common build tools:
Maven
Build directly to your local Docker daemon
If you have Docker running locally, use this command to build the image and load it straight into your Docker environment—no remote push involved:mvn jib:dockerBuildYou can then run the image using standard Docker commands, just like any locally built image.
Export as a standalone tar file
If you don’t want to rely on Docker, you can export the built image as a tar file (great for transferring or loading later):mvn jib:buildTarBy default, the tar file will be created at
target/jib-image.tar. To load it into Docker later, use:docker load -f target/jib-image.tar
Gradle
Build directly to your local Docker daemon
Similar to Maven, run this command to build and load the image into your local Docker instance:./gradlew jibDockerBuildExport as a standalone tar file
Generate a tar version of your image with:./gradlew jibBuildTarThe default output path is
build/jib-image.tar, and you can load it into Docker using the samedocker loadcommand mentioned above.
All these workflows skip the remote push step entirely—you get your fully built image locally, ready to test, run, or distribute however you need. No external registry required!
内容的提问来源于stack exchange,提问作者IsaacLevon

