Error getting while deploying application in docker in azure devops pipeline

Babychen Daisy, Dona 20 Reputation points
2023-07-14T15:13:01.69+00:00

Azure devops release pipeline fails with

[error]Unhandled: No Dockerfile matching  D:\a\r1\a\'$(Build.SourcesDirectory)\_db9crt_node-mongodb-app\Dockerfile'  was found.

Could some one tell what value we have to give in Dockerfile and Build context to get the pipeline run proper.
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,798 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Azar 22,355 Reputation points MVP
    2023-07-16T05:53:48.0166667+00:00

    Hi @Babychen Daisy, Dona

    The error indicates the file is missing in the path you sharedd,

    ensure that the build context is set to the correct location. You can specify the build context in your pipeline configuration, typically in the docker task or step. For example

    - task: Docker@2   
    displayName: Build and push image  
     inputs:     
    containerRegistry: 'yourContainerRegistry'    
     repository: 'yourRepository'    
     command: 'buildAndPush'     
    Dockerfile: '$(Build.SourcesDirectory)\_db9crt_node-mongodb-app\Dockerfile'   
      buildContext: '$(Build.SourcesDirectory)\_db9crt_node-mongodb-app'
     
    
    
    

    Verify that the Dockerfile exists at the specified location and that its filename is exactly "Dockerfile" (case-sensitive). Double-check the spelling, capitalization, and file extension.

    If this answer helps kindly accept the answer for any assistance ping in comments thanks much