Project Template: Gradle buildImages fails — “Connect to http://127.0.0.1:2375 failed: Connection refused” on macOS

Hi everyone,

I’m trying to build/run the A12 Project Template locally and hit a blocking issue when the Gradle Docker tasks run.

Environment

  • OS: macOS (Apple Silicon)

  • JDK: 21.0.9

  • Gradle: 8.14.3

  • Project: A12 Project Template - Community

  • Docker: Rancher Desktop installed

Command

  • ./gradlew :server:init:buildImages

  • ./gradlew :server:app:buildImages

Error


* What went wrong:

Execution failed for task ':server:init:buildImages'.

> com.bmuschko.gradle.docker.shaded.org.apache.hc.client5.http.HttpHostConnectException:

Connect to http://127.0.0.1:2375 [/127.0.0.1] failed: Connection refused

1: Task failed with an exception.

-----------

Same error for :server:app:buildImages.

What I tried

  • Ensured Rancher Desktop is running; docker info works.

  • Checked DOCKER_HOST. By default it was unset. I tried:

  • unset DOCKER_HOST (still fails)

  • export DOCKER_HOST=unix:///var/run/docker.sock (still fails)

Questions

  1. Where should I configure the bmuschko Docker plugin in the Project Template to make it use the Unix socket instead of http://127.0.0.1:2375?

  2. For local development, is building images required, or can I safely skip these tasks?

Additional context

  • Backend starts fine with bootRun when I avoid the image tasks:

./gradlew :server:app:bootRun

  • I’d like to keep the local workflow simple (no TCP 2375) and use the Rancher Desktop default (Unix socket).

Thanks for any pointers on the correct configuration/override inside the PT build!

Try

export DOCKER_HOST=“unix://$HOME/.rd/docker.sock”

If it works then set it in your shell (.bashrc, .zshrc) to make it permanent.

Hey Binh,
I’ve tried, but it throws another Error, saying the DOCKER_HOST Path contains illigal characters.

TestPackage2 git:(main) ✗ export DOCKER_HOST=“unix://$HOME/.rd/docker.sock”
➜  TestPackage2 git:(main) ✗ gradle :server:init:buildImages                  
> Task :buildSrc:compileJava NO-SOURCE
> Task :buildSrc:compileGroovy UP-TO-DATE
..
> Task :server:init:build UP-TO-DATE
> Task :server:init:createDockerfile UP-TO-DATE

> Task :server:init:buildImages FAILED
Building image using context '/Users/jhoehn/Documents/Projekte/Project Template/TestPackage2/server/init/build'.

[Incubating] Problems report is available at: file:///Users/jhoehn/Documents/Projekte/Project%20Template/TestPackage2/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':server:init:buildImages'.
> Illegal character in scheme name at index 0: “unix:///Users/jhoehn/.rd/docker.sock”

* 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.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.14.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1s
11 actionable tasks: 1 executed, 10 up-to-date
➜  TestPackage2 git:(main) ✗ export DOCKER_HOST=“unix://$HOME/.rd/docker.sock”

Hi @julius-low-kernel , discourse seems to add quote incorrectly. It should be correct below.

export DOCKER_HOST="unix://$HOME/.rd/docker.sock"