DEV Community

Discussion on: Container image promotion across environments - Build Artifact

Collapse
 
n3wt0n profile image
Davide 'CoderDave' Benvegnù

The reference does not exist means that the image you are trying to export\save\use is not there.

In your case it is because you are using the "wrong" name.

When you build the image, you have 3 parts: the container registry, the name itself, and the tag

When you try and save it tho you use only name and tag. You have to specify the container registry name as well. The Docker task do not propagate it to the command

It should be something like:

task: Docker@2 
command: 'save' 
arguments: --output $(build.artifactstagingdirectory)/bapp.prime.roadMapper.tar $(ContainerRegistryName)/bapp.prime.roadMapper:$(primeVersion)
Enter fullscreen mode Exit fullscreen mode

And $(ContainerRegistryName) is a variable that you have to save or create somewhere before that

Collapse
 
rulick76 profile image
Israel Rozen

Thank you very much! it is working :)
Just wondering why do I have to to explicitly specify again the container registry if I'm specifying it it the task itself in the third line (the connectionForLabBuild service connection already define it)...

Thank a lot! I really appreciate !

task: Docker@2
inputs:
containerRegistry: 'connectionForLabBuild'
repository: 'bapp.roadMapper'
command: 'save'
arguments: --output $(build.artifactstagingdirectory)/bapp.roadMapper.tar bapp.roadMapper:$(Version)

Thread Thread
 
n3wt0n profile image
Davide 'CoderDave' Benvegnù

The reason for this is that save is not a command that is implemented in the task out of the box.

It works because what the task does is just appending the command part to the docker command, and then append the arguments. But the other fields, like container registry, are ignored because the task code "doesn't know what to do" with a command that is not being implemented.

Hope this clarifies :)