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

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

docker build -t .

and then you can push:

docker push

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
containerRegistry: 'docker-hub'
repository: 'yousexapp'
command: 'buildAndPush'
Dockerfile: '**/dockerfile'

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