daniu
daniu

Reputation: 15008

Spring Boot 2.3 Maven Docker build adds "docker.io" prefix

I'm trying to build a Docker image for my Spring Boot service using mvn spring-boot:build-image as mentioned in the guide here. It also mentions

The result is an image called docker.io//:latest by default. You can modify the image name in Maven using

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <image>
                    <name>my/preferred/name</name>
                </image>
            </configuration>
        </plugin>
    </plugins>
</build>

It seems pretty straightforward... however, this results in a Docker image with the name docker.io/my/preferred/name.

How do I get rid of the docker.io prefix?

Upvotes: 2

Views: 1198

Answers (1)

Matus Dubrava
Matus Dubrava

Reputation: 14502

My guess is that you are confusing the parser with so many slashes (/). Since there is no reasonable way to parse my/preferred/name, it will be considered as just a name (as a whole) in which case the default docker.io/library/ will be prepended to it.

Here is how you can specify the name of the image in the name tag.

  • name (maps to docker.io/library/name)
  • domain/name
  • domain:port/name
  • domain:port/name:tag
  • domain:port/name@digest

Your my/preferred/name name falls under the first category.

Upvotes: 2

Related Questions