Sunday, February 9, 2020

Docker in Azure Pipeline

Docker use in pipeline:
-provides more contrl over where and how jobs are run
-enables a strategy of testing builds across different OS versions
-Decouples app dependecies from supporting host system



Agent acts as the Docker host(Hosted Linux and vs2017)
----------
for microsoft hosted agents are already enabled docker engine for both linux and windows.
for self hosted, we need to enable that.
it needs win10 or server 16 and above.
Functions exposed by native tasks or docker binary (script)
cached containers are not persisted on Microsoft-hosted agents.but we have option in server 2019 for precached containers.
Jobs are executed within an agentless container on a Docker host.
supports containers running both windows and linux.but in ms hosted, we need separate hhosts for linux and windows.for self hosted, we can have server 19 to have both on same machine.
containers can be retrieved from private registries.you need to create an endpoint in the azure devops.

htps://docs.microsoft.com/en-us/azure/devops/pipelines/languages/docker

other option:
agent runs within the container, docker host is agentless.
agent runs on windows server core or ubuntu container images

There is an option to choose containers run on self-hosted system or azure container instances (ACI)/azure kubernetes service(AKS)

htps://docs.microsoft.com/en-us/azure/devops/pipelines/agents/docker

Implement a self-hosted docker agent and verify agent functionality:
--------
on server 2019

Dockerfile:







docker build -t dockeragent-windows:latest .
docker image list ->shows a new image.

then register a new container and register it.



pipeline sample:


pipeline sample for using ACS.


the new image visible at services-repos section

create a container-based solution,deploy and verify solution:
---------


below will launch an image in acs:
---


in aks:
----









No comments:

Post a Comment