Azure DevOps CD Pipeline with private Docker Hub - docker

I'm trying to create a CI/CD pipeline in Azure DevOps for my Application. With the Build Pipeline section I have no problem. It's a react app which gets build and hosted (nginx) via a Docker Container. So building the Docker Container and pushing it to my private Docker Hub is no problem, that will work.But I actually can't figure out how to configure the release pipeline to deploy to a Azure WebApp for Containers with a private Docker Hub. Because there is no option for a service connection or Login Credentials to Configure. Would be nice if someone could help me and give a hint.
Thanks

But I actually can't figure out how to configure the release pipeline
to deploy to a Azure WebApp for Containers with a private Docker Hub.
Because there is no option for a service connection or Login
Credentials to Configure. Would be nice if someone could help me and
give a hint.
You don't need to provide service connection or Login Credentials of private Docker Hub within the Azure Web App For containers task or Azure App Service Deploy task.
Instead you should configure the credentials in Azure Web Portal. Go Azure Web Portal=>App Service=>Settings=>Container Settings you'll see:
You can enter your credentials there or you can configure the credentials when creating Azure App Service.
Since your Azure App Service can access your Private Docker Hub and deployment tasks in Azure Devops pipeline can access the Azure App Service with Azure Subscription input, the Azure WebApp for Containers task can automatically access the Private Docker Hub registry. (That's why you don't have/need an option to provide credentials of private docker hub!)

Related

Deploy docker to on-premise using azure CI-CD

I have created.NetCore Application and was successfully deployed to the local PC docker container.
Now I am trying to build it from Azure DevOps and publish it to one of my servers hosted on-premise.
Now I have no idea how to host it. Also not sure what is Docker Registry Service Connection & Container Registry Type.
My DevOps server is also hosted on-premise with no docker installed on it.
I have a docker account with one private repository.
Please suggest how to continue as I am getting the below error while building the image
open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Thanks
Deploy docker to on-premise using azure CI-CD
If you want to deploy app to the local PC docker container, you can use Self-hosted Agent(Build Pipeline and Release Pipeline) or Deployment Group(Release Pipeline).
Note: we need set the self-agent on the server where have docker installed.
Then you could try the following pipeline settings.
Here is a blog about ASP.Net Application Deployment in Docker for Windows.
You could use Command Line Task to run the docker command. In this case, you can move the local build and deploy process to azure devops

Is one required to use Azure Container Registry to make use of Azure Containers?

I'm doing research on how container services in Azure compare with our on-prem implementation of containers, which includes Docker Trusted Registry.
Is one required to use Azure Container Registry to make use of Azure Containers? Or could we tie into our existing on-prem Docker Trusted Registry?
Thank you!
Yes, you could use a private registry---Docker Trusted Registry for Azure Container Instance.
Containers are built from images that are stored in one or more
repositories. These repositories can belong to a public registry, like
Docker Hub, or to a private registry. An example of a private registry
is the Docker Trusted Registry, which can be installed on-premises or
in a virtual private cloud. You can also use cloud-based private
container registry services, including Azure Container Registry.
A publicly available container image does not guarantee security.
Container images consist of multiple software layers, and each
software layer might have vulnerabilities. To help reduce the threat
of attacks, you should store and retrieve images from a private
registry, such as Azure Container Registry or Docker Trusted Registry.
In addition to providing a managed private registry, Azure Container
Registry supports service principal-based authentication through Azure
Active Directory for basic authentication flows. This authentication
includes role-based access for read-only (pull), write (push), and
other permissions.
When you create the ACI via the Azure portal, you will see the three options.

How to run docker image in AKS without using docker repository

I am using Azure Kubernetes Service(AKS) and I am no allowed to use Docker Hub repository for pushing and pulling Images, so please tell me, is there a way to create kubernetes deployments or pods by using tar of image or by pulling image using ssh connection from other server in which I am having Docker engine running.
I am assuming that the reason why you are not allowed to use Docker Hub is because of the company policy that wants to keep everything private and contained within Azure.
In that case, I suggest using the Azure's own container registry service named Azure Container Registry which have the following benefit:
It works similar to DockerHub in the sense that you can just sign in with username and password, update the image name and you are good to go.
It is the solution from Azure which should fit nicely in your Infrastructure design. Please refer to this link for details instructions on how to connect your AKS and ACR.
The traffic flow from AKS and ACR is private and not exposed to the Internet.

Set Docker daemon options on Azure hosted agent

I'm messing around with Artifactory and have used the artififactory-pro docker container to get me up and running on an azure vm. I'm now trying to push a docker image to the docker-local repository within Artifactory. This is working locally but I had to change my local docker options to include the insecure-registry I set up.
To continue my POC further I want to be able to push to the artifactory docker repo using the MS hosted 'ubuntu-latest' agent with Azure pipelines but I believe I need to set the docker options on the agent to again allow the insecure regsitry as it's currently throwing the error:
[Error] Docker login failed for: http:/, http:.
How do I set the docker options on the MS hosted agent within my pipeline? I'm having to install .net-core 3.1 sdk during the pipeline so i'd like to think it is possible.
Thanks
As far as I know, you cannot set docker options to allow insecure regsitry on MS hosted agent. To set insecure registry, you have to modify some docker config file. But we are restricted to modify the system files of MS hosted agent for security reason, you will get access denied error if you try to do so.
The workaround is to create your own self-hosted agent on your local machine. So that you can set the insecure registry for docker daemon on local machine.
However you can also submit a feature request(click suggest a feature and choose azure devops) to Microsoft Development team. Hope they will consider implementing a feature to enable seting docker options on MS hosted agent.

Replicating a docker registry from azure to aws

I'm searching for a replication solution for a private docker registry from azure to aws (managed container service aws ecr, or my own private hosted docker registry if needed, hopefully not). is there a builtin docker registry option to do that? or other known solution? or perhaps another registry provider that is hosted in AWS - east? my google foo failed me this time.
Please note: This is a question about replication, not about one time migration. Our main registry would still be in azure container registry
There is no native replication options across ACR and ECR. You might be able to integrate with the webhooks and replicate delete/push using the digest and tag to ECR. This might require a custom job (jenkins/VSTS/VM) etc.

Resources