Alberto de Blas
Alberto de Blas

Reputation: 58

Error in pom.xml: Element docker is not allowed here

Following this question and these instructions, I get the error in pom: Element docker is not allowed here.

EDIT: The complete pom

Any thoughts about what I am missing?

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>build-image</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <image>
            <name>docker.example.com/library/${project.artifactId}</name>
            <publish>true</publish>
        </image>
        <docker>
            <publishRegistry>
                <username>user</username>
                <password>secret</password>
                <url>https://docker.example.com/v1/</url>
                <email>[email protected]</email>
            </publishRegistry>
        </docker>
    </configuration>
</plugin>

Upvotes: 1

Views: 1290

Answers (1)

Andres Sacco
Andres Sacco

Reputation: 668

I check the documentation that you mention and this option is available in version > 2.4.x of Spring that is the reason for your project's failure. If you update the parent-pom to > 2.4.x this will works.

I run this command mvn spring-boot:build-image

[INFO]     [creator]     *** Images (4a75f3011ab0):
[INFO]     [creator]           docker.example.com/library/coding-challenge:latest
[INFO]
[INFO] Successfully built image 'docker.example.com/library/coding-challenge:latest'
[INFO]
[INFO]  > Pushing image 'docker.example.com/library/coding-challenge:latest' 100%

Upvotes: 1

Related Questions