0

I am trying to solve a problem generating a snippet of markdown. I am using Eclipse JKube to build an image in which there are embedded release material and docs. I instruct users to run some commands to copy these resources locally:

From a shell enter this directory and run the appropriate command below.
   For **Powershell**:  
   `($id = docker create ${jkube.docker.registry}/${dockerRepoPrefix}/${dkr_image_name}:${dkr_image_tag}); (docker cp "$($id):/usr/aws-build/." .); (docker rm -v $id)`

As you can see I am attempting to use Maven filtering so that different target registries and repos and tags all get correct instructions. Note: I need Markdown, not processed Markdown, as I need to supply that to different doc generators.

The problem is that for DockerHub the registry is empty resulting in something like:

From a shell enter this directory and run the appropriate command below.
   For **Powershell**:  
   `($id = docker create /acme-hammers/banger:v0.8.9); (docker cp "$($id):/usr/aws-build/." .); (docker rm -v $id)`
                         ^._ THE PROBLEM

That leading slash breaks it.

I cannot a solution using filtering or Maven properties. It needs some dynamic way to exclude the slash. For example if I were to use an aggregate property, the problem just moves there:

<properties>
...
  <fullImgName>${jkube.docker.registry}/${dockerRepoPrefix}/${dkr_image_name}:${dkr_image_tag}</fullImgName>
...
</properties>

I also cannot just use the DockerHub registry explicitly like this:

($id = docker create registry.hub.docker.com/acme-hammers/banger:v0.8.9); (docker cp "$($id):/usr/aws-build/." .); (docker rm -v $id)

The image is not stored that way in the local Daemon (the registry is removed for DockerHub builds) and it fails to resolve.

Is there a good way, either with Maven filtering, or other, to optionally exclude the '/' when there is no registry specified, or when the DockerHub registry is supplied?

Alternatively is there a way to force JKube to always include the registry in the image name?

Dennis
  • 3,683
  • 1
  • 21
  • 43

0 Answers0