spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.66k stars 575 forks source link

Image name with private registry having port cannot be pushed #319

Closed cstettler closed 6 years ago

cstettler commented 7 years ago

Description

In case an image name provided in the plugin configuration contains a private registry with a port, pushing that image does not work, as the port is mistaken as a tag when parsing the image name and tag into the composite image name.

How to reproduce

Define e.g. my-registry:8888/imageName as the image name in the plugin. When trying to push the image (with pushImageTags only), the plugin tries to push to docker.io/library/my-registry.

What do you expect

The port must not be taken as a tag. The :separator should only be used as a separator between the image name and the tag, if either no registry is provided or if the separator occurs after the registry part (i.e. after the last /).

What happened instead

The port is taken as a tag, and as a consequence, the image name is reduced to only the registry part (without port and without image name), which makes Docker think that it is an image name to be pushed to Docker Hub.

Software:

Full backtrace

[...|
[INFO] Pushing ...
The push refers to a repository [docker.io/library/my-registry]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[...]
serut commented 7 years ago

We can confirm we have the same issue on our side.

The dirtyfix that we use is to deploy a registry on the 443 port and remove the port inside the maven configuration. The HTTP / HTTPS protocol implicitly add the port automatically.

Before :

my-registry:5000/my-app

Into (implicit 443)

https://my-registry/my-app
davidxia commented 6 years ago

Is this still an issue with the latest version?

davidxia commented 6 years ago

fixed by https://github.com/spotify/docker-maven-plugin/pull/320