The Maven and Gradle plugins will use the values of DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT_PATH environment variables to connect to a remote Docker daemon. These environment variables are convenient when using minikube, but it would also be nice if the connection details could be specified in the build plugin configuration as an alternative to the environment.

With Gradle:

bootBuildImage {
    docker {
        host = "tcp://192.168.99.100:2376"
        tlsVerify = true
        certPath = "/home/user/.minikube/certs"
    }
}

With Maven:

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
            <docker>
                <host>tcp://192.168.99.100:2376</host>
                <tlsVerify>true</tlsVerify>
                <certPath>/home/user/.minikube/certs</certPath>
            </docker>
        </configuration>
    </plugin>