linuxazureazure-clicontainer-registry

How to create azure acr task without providing git repository?


I was able to create a azure acr task using the below command:

az acr task create --registry myregistry \
           --name demo_task \
                   --image demo_app:{{.Run.ID}} \
                   --file demo.Dockerfile \
                   --context https://github.com/hm-group/repo.git#branch \
                   --git-access-token your_token --debug

But, I don't want to provide git repository. Just want to use --file and tried build this task using below command:

az acr task create --registry productionai \
           --name demo_task \
                   --image demo_app:{{.Run.ID}} \
                   --file demo.Dockerfile 

Error:

If the task is not a System Task, --context-path must be provided.


Solution

  • We can provide --context as /dev/null if we want to use only file without providing context.

    Command:

    az acr task create --registry myregistry \
                       --name demo_task \
                       --image demo_app:{{.Run.ID}} \
                       --file demo.Dockerfile \
                       --context /dev/null