diff --git a/extensions/container-image/deployment/pom.xml b/extensions/container-image/deployment/pom.xml
index 4eab095b553f5..c7938fe65f856 100644
--- a/extensions/container-image/deployment/pom.xml
+++ b/extensions/container-image/deployment/pom.xml
@@ -42,8 +42,8 @@
quarkus-container-image
- org.junit.jupiter
- junit-jupiter
+ io.quarkus
+ quarkus-junit5-internal
test
diff --git a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageConfig.java b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageConfig.java
index f093801383318..9db9a56e09fc7 100644
--- a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageConfig.java
+++ b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageConfig.java
@@ -24,7 +24,7 @@ public class ContainerImageConfig {
*/
@ConfigItem(defaultValue = "${quarkus.application.name:unset}")
@ConvertWith(TrimmedStringConverter.class)
- public Optional name;
+ public String name;
/**
* The tag of the container image. If not set defaults to the application version
diff --git a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageProcessor.java b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageProcessor.java
index 0558bd01afc5f..742e2a718e54e 100644
--- a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageProcessor.java
+++ b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/ContainerImageProcessor.java
@@ -89,8 +89,7 @@ public void publishImageInfo(ApplicationInfoBuildItem app,
}
String effectiveName = containerImageCustomName.map(ContainerImageCustomNameBuildItem::getName)
- .or(() -> containerImageConfig.name)
- .orElse(app.getName());
+ .orElse(containerImageConfig.name);
String repository = (containerImageConfig.getEffectiveGroup().map(s -> s + "/").orElse("")) + effectiveName;
if (!ImageReference.isValidRepository(repository)) {
throw new IllegalArgumentException("The supplied combination of container-image group '"
diff --git a/extensions/container-image/deployment/src/test/java/io/quarkus/container/image/deployment/InvalidConfigInNameTest.java b/extensions/container-image/deployment/src/test/java/io/quarkus/container/image/deployment/InvalidConfigInNameTest.java
new file mode 100644
index 0000000000000..f4c2fc4a95c52
--- /dev/null
+++ b/extensions/container-image/deployment/src/test/java/io/quarkus/container/image/deployment/InvalidConfigInNameTest.java
@@ -0,0 +1,25 @@
+package io.quarkus.container.image.deployment;
+
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.util.NoSuchElementException;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import io.quarkus.test.QuarkusUnitTest;
+
+public class InvalidConfigInNameTest {
+
+ @RegisterExtension
+ static QuarkusUnitTest runner = new QuarkusUnitTest()
+ .setExpectedException(NoSuchElementException.class)
+ .withEmptyApplication()
+ .overrideConfigKey("quarkus.container-image.build", "true")
+ .overrideConfigKey("quarkus.container-image.name", "test-${foo.bar}");
+
+ @Test
+ void shouldThrow() {
+ fail("Should not be run");
+ }
+}