Skip to content

Commit 21978da

Browse files
anthonydahannescottfrederick
authored andcommitted
Add documentation for publishing images with Maven command line
See gh-34517
1 parent fbce81f commit 21978da

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,25 @@ The `publish` option can be specified on the command line as well, as shown in t
357357
$ mvn spring-boot:build-image -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 -Dspring-boot.build-image.publish=true
358358
----
359359

360+
If you intend to invoke the `publish` option on the command line, with authentication, you'll need the combination of this command line:
361+
362+
[indent=0]
363+
----
364+
$ mvn spring-boot:build-image \
365+
-Ddocker.publishRegistry.username=user \
366+
-Ddocker.publishRegistry.password=secret \
367+
-Ddocker.publishRegistry.url=docker.example.com \
368+
-Dspring-boot.build-image.publish=true \
369+
-Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 \
370+
----
371+
372+
and this XML configuration:
373+
374+
[source,xml,indent=0,subs="verbatim,attributes",tabsize=4]
375+
----
376+
include::../maven/packaging-oci-image/docker-pom-authentication-command-line.xml[tags=docker]
377+
----
378+
360379
[[build-image.examples.caches]]
361380
=== Builder Cache Configuration
362381

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- tag::docker[] -->
3+
<project>
4+
<build>
5+
<plugins>
6+
<plugin>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-maven-plugin</artifactId>
9+
<configuration>
10+
<docker>
11+
<publishRegistry>
12+
<url>${docker.publishRegistry.url}</url>
13+
<username>${docker.publishRegistry.username}</username>
14+
<password>${docker.publishRegistry.password}</password>
15+
</publishRegistry>
16+
</docker>
17+
</configuration>
18+
</plugin>
19+
</plugins>
20+
</build>
21+
</project>
22+
<!-- end::docker[] -->

0 commit comments

Comments
 (0)