When you use containers for your application, one of the things you need to think about is how to move (aka promote) the container images you gener...
For further actions, you may consider blocking this person and/or reporting abuse
Hi Davide,
I'm trying to use this approach but keep getting "reference does not exist" from deamon when trying to save the image to tar.
task: Docker@2
inputs:
containerRegistry: 'connectionForLabBuild'
repository: 'bapp.roadMapper'
command: 'build'
Dockerfile: '$(Build.SourcesDirectory)/bapp/bapp.roadMapper/Dockerfile'
tags: '$(Version)'
task: Docker@2
inputs:
containerRegistry: 'connectionForLabBuild'
repository: 'bapp.roadMapper'
command: 'save'
arguments: --output $(build.artifactstagingdirectory)/bapp.roadMapper.tar bapp.roadMapper:$(Version)
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:
And
$(ContainerRegistryName)
is a variable that you have to save or create somewhere before thatThank 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)
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 thedocker
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 :)
Thank you for your super article. Do you know how to set up if we want to deploy the image on on premise server with docker installed on it instead of a provider container registry like ACR ?
Thanks for the feedback :)
Well, even if you deploy to a local server on-prem, you would still need to use a container registry (either on-cloud or on-prem) to host your images that then docker can pull.
There is a "workaround" but I do not endorse it. When you have your imaged built and saved in the tar file using
docker save
, then you could copy that tar file to your target server and re-hydrate the image usingdocker load
... this way you'd have the image directly on the server and you wouln't need a registry.Once again, I do not recommend nor endorse this approach :)
This is the way!
This is brilliant and exactly what I was looking for. Thanks for sharing.
Thanks for your comment :)
I've just published another post of the same series, to achieve the same thing but all with the YAML pipelines. Let me know what you think :)