Wednesday, 9 October 2019

azure docker hub and link it to azure dev ops

as you know if you want to deploy your docker image , you need to push it to a hub then ask k8s to load it from the hub.

docker hub is a public hub, you cannot use most of time, because your image will have your application build in.

So Azure docker container is a private hub you can use for your project.


how to push locally:

to link to it you will need to get username and password and then:

docker login --username XXXX --password XXXXXX yoursexproject.azurecr.io


then you need to build your image: (the image name should have your hub name)

docker build -t yoursexproject.azurecr.io/yousexapp:88 .

and then you can push:

docker push yoursexproject.azurecr.io/yousexapp:88

then you can find it here:(on azure portal)




how to use it in azure dev ops:

you need to link your pipeline to your hub:(container)





then you can use it in your pipline:


- task: Docker@2
displayName: Dockerize
inputs:
containerRegistry: 'docker-hub'
repository: 'yousexapp'
command: 'buildAndPush'
Dockerfile: '**/dockerfile'


your job will fail, then you just need to authroise it:









2 comments: