I'm trying to create a docker image of a Spring Boot application using the Gradle plugin. I'm using Spring Boot 2.6.4 and Gradle 7.1.1.
I'm on a Mac, and I don't have Docker Desktop installed. Indeed, I run docker using Colima.
The problem is that I cannot build the docker image with the command ./gradlew bootBuildImage since Gradle cannot find the docker daemon:
Connection to the Docker daemon at 'localhost' failed with error "[2] No such file or directory"; ensure the Docker daemon is running and accessible
Is there any configuration I have to do in Colima or my build.gradle file?
Colima creates a socket in the location
~/.colima/docker.sockby default. Running the commanddocker context lsshould show a context namedcolimawith the socket location shown in theDOCKER ENDPOINTcolumn.You can configure the Spring Boot Gradle plugin to use this socket by setting the
DOCKER_HOSTenvironment variable tounix:///Users/<user>/.colima/docker.sockor by adding the following to your build file as shown in the documentation.