If you have built your Sitecore container images and they reside locally and you want to share them with your team the recommended approach is a private registry and there are a few services available. However, Azure Container Registry (ACR) allows you to store docker images in repositories and can take advantage of the azure pipelines to automatically rebuild these images when they need to be updated. In this post, I will show you how to push your local images to a private ACR. This also works if you need to move your images from one private registry to another.
First, you need to create a private Azure container registry if you don’t already have one. Once created you can log in to the registry and push images to the repository.
PS> docker login [registry name].azurecr.io -u [username] -p [password]
Before you can push a local image to the registry you need to add a tag the image for the new registry.
PS> docker tag [image id] [registryname]/[image name]:[tag]
For example if I have a local image id:e4bc638e03eb name:sitecore-xp-sxa-sqldev with a tag:9.2.0-windowsservercore-1903 and my registry name mysitecoreregistry
PS> docker tag e4bc638e03eb mysitecoreregistry/sitecore-xp-sxa-sqldev:9.2.0-windowsservercore-1903
You can check the image has been tagged with ps> docker image ls. Now all you have to do is use the docker push command the image to the registry.
PS> docker push [registry]/[image]:[tag]
Using my example above this would become:
PS> docker push mysitecoreregistry/sitecore-xp-sxa-sqldev:9.2.0-windowsservercore-1903
NOTE: during the push, you might see in the following output Skipped Foreign Layer – don’t be alarmed this is expected as Docker does not push the base Windows layers to private registries.