Error getting while deploying application in docker in azure devops pipeline

Babychen Daisy, Dona 20 Reputation points

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.
34,860 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Azar 13,705 Reputation points

    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  
    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