Reputation: 2245
On my local machine at the command line I run:
docker run \
--rm --name MyImage \
-e POSTGRES_USER=user \
-e POSTGRES_PASSWORD=myPass \
-e POSTGRES_DB=myDB-db \
-d \
-p 5432:5432 \
--mount "type=bind,source=C:\docker\postgres,destination=C:\pgsql\data" \
stellirin/postgres-windows
This starts up my postgres DB, and then I run my NUnit tests which call the DB running in the container with port mapped to http://localhost:5432 This works fine locally. I use continuation integration on Azure Devops and I would like to get this to work on azure. Important point: I do not want to use Azure Container Registry since I already have a docker hub account, and the azure registry will add additional costs and overhead of copying images from DockerHub to the Azure registry.
Is this possible using yaml in a build pipeline (pulling from docker hub, building and running the container)?
Unfortunately it seems most of the information I find on Google requires Azure Container Registry.
Upvotes: 4
Views: 6434
Reputation: 1407
You should create a service connection in Project Settings -> Service connection first. Then choose the Docker Registry and input the information.
The following is the script about how to pull and run image from docker hub in YAML.
And you can edit it with Task assistant in Azure pipeline.
In addition, if you want to use the image in Azure, the ACR is required. Because ACR is the way which images can be stored on the Azure.
Upvotes: 4