Skip to content

Commit ac949d7

Browse files
Document remote Docker configuration
This commit adds documentation for the configuration required to use a remote Docker daemon with the `build-image` Maven goal or the `bootBuildImage` Gradle task. See gh-20538
1 parent 9ebad0d commit ac949d7

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/packaging-oci-image.adoc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
[[build-image]]
22
== Packaging OCI images
33
The plugin can create an https://github.com/opencontainers/image-spec[OCI image] from executable jars using https://buildpacks.io[Cloud Native Buildpacks].
4-
Images can be built using the `bootBuildImage` task and a local Docker installation.
4+
Images can be built using the `bootBuildImage` task.
55
The task is automatically created when the `java` plugin is applied and is an instance of {boot-build-image-javadoc}[`BootBuildImage`].
66

77

8+
[[build-image-docker-daemon]]
9+
=== Docker daemon
10+
11+
The `bootBuildImage` task requires access to a Docker daemon.
12+
By default, it will communicate with a Docker daemon over a local connection.
13+
This works with https://docs.docker.com/install/[Docker Engine] on all supported platforms without configuration.
14+
15+
Environment variables can be set to configure the `bootBuildImage` task to use the https://minikube.sigs.k8s.io/docs/tasks/docker_daemon/[Docker daemon provided by minikube].
16+
The following table shows the environment variables and their values:
17+
18+
|===
19+
| Environment variable | Description
20+
21+
| DOCKER_HOST | URL containing the host and port for the Docker daemon - e.g. `tcp://192.168.99.100:2376`
22+
| DOCKER_TLS_VERIFY | Enable secure HTTPS protocol when set to `1` (optional)
23+
| DOCKER_CERT_PATH | Path to certificate and key files for HTTPS (required if `DOCKER_TLS_VERIFY=1`, ignored otherwise)
24+
|===
25+
26+
On Linux and macOS, these environment variables can be set using the command `eval $(minikube docker-env)` after minikube has been started.
827

928
[[build-image-customization]]
1029
=== Image Customizations

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
== Packaging OCI Images
33

44
The plugin can create an https://github.com/opencontainers/image-spec[OCI image] using https://buildpacks.io/[Cloud Native Buildpacks].
5-
Images can be built using the `build-image` goal and a local Docker installation.
5+
Images can be built using the `build-image` goal.
66

77
The easiest way to get started is to invoke `mvn spring-boot:build-image` on a project.
88
It is possible to automate the creation of an image whenever the `package` phase is invoked, as shown in the following example:
@@ -31,6 +31,26 @@ TIP: While the buildpack runs from an <<repackage,executable archive>>, it is no
3131
When the `build-image` repackages the application, it applies the same settings as the `repackage` goal would, i.e. dependencies can be excluded using one of the exclude options, and Devtools is automatically excluded by default (you can control that using the `excludeDevtools` property).
3232

3333

34+
[[build-image-docker-daemon]]
35+
=== Docker daemon
36+
37+
The `build-image` goal requires access to a Docker daemon.
38+
By default, it will communicate with a Docker daemon over a local connection.
39+
This works with https://docs.docker.com/install/[Docker Engine] on all supported platforms without configuration.
40+
41+
Environment variables can be set to configure the `build-image` goal to use the https://minikube.sigs.k8s.io/docs/tasks/docker_daemon/[Docker daemon provided by minikube].
42+
The following table shows the environment variables and their values:
43+
44+
|===
45+
| Environment variable | Description
46+
47+
| DOCKER_HOST | URL containing the host and port for the Docker daemon - e.g. `tcp://192.168.99.100:2376`
48+
| DOCKER_TLS_VERIFY | Enable secure HTTPS protocol when set to `1` (optional)
49+
| DOCKER_CERT_PATH | Path to certificate and key files for HTTPS (required if `DOCKER_TLS_VERIFY=1`, ignored otherwise)
50+
|===
51+
52+
On Linux and macOS, these environment variables can be set using the command `eval $(minikube docker-env)` after minikube has been started.
53+
3454

3555
[[build-image-customization]]
3656
=== Image Customizations

0 commit comments

Comments
 (0)