question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker task cannot find dockerfile in staging directory,

See original GitHub issue

Environment

VSTS: provisioinsights / spectre, Build: InitialProcessor / Build 20171014.6 Agent: Hosted VS2017

Issue Description

Docker task cannot find dockerfile in staging directory,

Tasks

  • Copy files: including **\Dockerfile-Publish to $(build.artifactstagingdirectory)
  • Docker: Action: build image, Docker file: $(build.artifactstagingdirectory)\**\Dockerfile-Publish

Error No Docker file matching d:\a\1\a**\Dockerfile-Publish was found.

Copy files task logs show that the file is indeed copied and I can also see the Dockerfile-Publish in artifacts. Is the docker task trying to find this pattern inside the source directory?

Logs

Copy files task

    2017-10-14T03:46:06.6232438Z Copying d:\a\1\s\src\Spectre.InitialProcessor.TestConsole\Dockerfile-Publish to d:\a\1\a\src\Spectre.InitialProcessor.TestConsole\Dockerfile-Publish

Docker task

2017-10-14T03:46:06.6392417Z ##[debug]Evaluating condition for step: 'Build an image'
2017-10-14T03:46:06.6392417Z ##[debug]Evaluating: succeeded()
2017-10-14T03:46:06.6392417Z ##[debug]Evaluating succeeded:
2017-10-14T03:46:06.6392417Z ##[debug]=> (Boolean) True
2017-10-14T03:46:06.6392417Z ##[debug]Expanded: True
2017-10-14T03:46:06.6392417Z ##[debug]Result: True
2017-10-14T03:46:06.6392417Z ##[section]Starting: Build an image
2017-10-14T03:46:06.6392417Z ==============================================================================
2017-10-14T03:46:06.6392417Z Task         : Docker
2017-10-14T03:46:06.6392417Z Description  : Build, tag, push, or run Docker images, or run a Docker command. Task can be used with Docker or Azure Container registry.
2017-10-14T03:46:06.6392417Z Version      : 0.3.1
2017-10-14T03:46:06.6392417Z Author       : Microsoft Corporation
2017-10-14T03:46:06.6392417Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=848006)
2017-10-14T03:46:06.6392417Z ==============================================================================
2017-10-14T03:46:06.8472320Z ##[debug]agent.workFolder=d:\a
2017-10-14T03:46:06.8502325Z ##[debug]loading inputs and endpoints
2017-10-14T03:46:06.8522325Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2017-10-14T03:46:06.8522325Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2017-10-14T03:46:06.8522325Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_ACTION
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_CONTAINERREGISTRYTYPE
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_CONTEXT
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_CWD
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_DEFAULTCONTEXT
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_DETACHED
2017-10-14T03:46:06.8532323Z ##[debug]loading INPUT_DOCKERFILE
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_IMAGEDIGESTFILE
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_IMAGENAME
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_IMAGENAMESPATH
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_INCLUDELATESTTAG
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_INCLUDESOURCETAGS
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_QUALIFYIMAGENAME
2017-10-14T03:46:06.8662318Z ##[debug]loading INPUT_RESTARTPOLICY
2017-10-14T03:46:06.8662318Z ##[debug]loaded 17
2017-10-14T03:46:06.9012299Z ##[debug]check path : d:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\0.3.1\task.json
2017-10-14T03:46:06.9012299Z ##[debug]set resource file to: d:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\0.3.1\task.json
2017-10-14T03:46:06.9012299Z ##[debug]system.culture=en-US
2017-10-14T03:46:06.9042294Z ##[debug]cwd=d:\a\1\s
2017-10-14T03:46:06.9052308Z ##[debug]containerregistrytype=Container Registry
2017-10-14T03:46:06.9062298Z ##[debug]dockerRegistryEndpoint=null
2017-10-14T03:46:06.9062298Z ##[debug]Absolute path for pathSegments: d:\a\_tool\NuGet\4.3.0\x64/docker = d:\a\_tool\NuGet\4.3.0\x64\docker
2017-10-14T03:46:06.9072411Z ##[debug]Absolute path for pathSegments: C:\LR\mms\Services\Mms\Provisioner\TaskAgent\agents\2.123.0\externals\git\cmd/docker = C:\LR\mms\Services\Mms\Provisioner\TaskAgent\agents\2.123.0\externals\git\cmd\docker
2017-10-14T03:46:06.9072411Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin/docker = C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\docker
2017-10-14T03:46:06.9072411Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft MPI\Bin\/docker = C:\Program Files\Microsoft MPI\Bin\docker
2017-10-14T03:46:06.9072411Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\Python36-32\Scripts\/docker = C:\Program Files (x86)\Python36-32\Scripts\docker
2017-10-14T03:46:06.9072411Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\Python36-32\/docker = C:\Program Files (x86)\Python36-32\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Windows\system32/docker = C:\Windows\system32\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Windows/docker = C:\Windows\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Windows\System32\Wbem/docker = C:\Windows\System32\Wbem\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Windows\System32\WindowsPowerShell\v1.0\/docker = C:\Windows\System32\WindowsPowerShell\v1.0\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\/docker = C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft SQL Server\130\Tools\Binn\/docker = C:\Program Files\Microsoft SQL Server\130\Tools\Binn\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Program Files (x86)\GtkSharp\2.12\bin/docker = C:\Program Files (x86)\GtkSharp\2.12\bin\docker
2017-10-14T03:46:06.9082294Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft\Web Platform Installer\/docker = C:\Program Files\Microsoft\Web Platform Installer\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\Program Files\nodejs\/docker = C:\Program Files\nodejs\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps/docker = C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\NPM\Modules/docker = C:\NPM\Modules\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\Program Files\Git LFS/docker = C:\Program Files\Git LFS\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\Program Files\CMake\bin/docker = C:\Program Files\CMake\bin\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\java\ant\apache-ant-1.9.7\bin/docker = C:\java\ant\apache-ant-1.9.7\bin\docker
2017-10-14T03:46:06.9092296Z ##[debug]Absolute path for pathSegments: C:\java\maven\apache-maven-3.2.2\bin/docker = C:\java\maven\apache-maven-3.2.2\bin\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: C:\Program Files\Java\jdk1.8.0_112\bin/docker = C:\Program Files\Java\jdk1.8.0_112\bin\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: C:\Program Files\dotnet\/docker = C:\Program Files\dotnet\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code/docker = C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager/docker = C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: C:\Users\testusername\AppData\Local\Microsoft\WindowsApps/docker = C:\Users\testusername\AppData\Local\Microsoft\WindowsApps\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: \Docker/docker = d:\Docker\docker
2017-10-14T03:46:06.9102300Z ##[debug]Absolute path for pathSegments: C:\Users\MMSImgGenVM2017\AppData\Local\Microsoft\WindowsApps/docker = C:\Users\MMSImgGenVM2017\AppData\Local\Microsoft\WindowsApps\docker
2017-10-14T03:46:06.9112304Z ##[debug]Absolute path for pathSegments: C:\Program Files\Python36/docker = C:\Program Files\Python36\docker
2017-10-14T03:46:06.9112304Z ##[debug]Absolute path for pathSegments: C:\Users\MMSImgGenVM2017\AppData\Local\Microsoft\WindowsApps/docker = C:\Users\MMSImgGenVM2017\AppData\Local\Microsoft\WindowsApps\docker
2017-10-14T03:46:06.9112304Z ##[debug]Absolute path for pathSegments: C:\Users\MMSImgGenVM2017\AppData\Local\Microsoft\WindowsApps/docker = C:\Users\MMSImgGenVM2017\AppData\Local\Microsoft\WindowsApps\docker
2017-10-14T03:46:06.9112304Z ##[debug]Absolute path for pathSegments: C:\Program Files\Docker/docker = C:\Program Files\Docker\docker
2017-10-14T03:46:06.9112304Z ##[debug]check path : C:\Program Files\Docker\docker.exe
2017-10-14T03:46:06.9112304Z ##[debug]docker=C:\Program Files\Docker\docker.exe
2017-10-14T03:46:06.9112304Z ##[debug]dockerHostEndpoint=null
2017-10-14T03:46:06.9122301Z ##[debug]action=Build an image
2017-10-14T03:46:06.9152292Z ##[debug]C:\Program Files\Docker\docker.exe arg: build
2017-10-14T03:46:06.9162302Z ##[debug]dockerFile=d:\a\1\a\**\Dockerfile-Publish
2017-10-14T03:46:06.9182294Z ##[debug]Pattern found in docker filepath parameter
2017-10-14T03:46:06.9182294Z ##[debug]System.DefaultWorkingDirectory=d:\a\1\s
2017-10-14T03:46:06.9182294Z ##[debug]findPath: 'd:\a\1\s'
2017-10-14T03:46:06.9182294Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2017-10-14T03:46:06.9182294Z ##[debug]findOptions.followSymbolicLinks: 'true'
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s (directory)
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s\.git (directory)
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s\.git\config (file)
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s\.git\description (file)
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s\.git\FETCH_HEAD (file)
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s\.git\HEAD (file)
2017-10-14T03:46:06.9202298Z ##[debug]  d:\a\1\s\.git\hooks (directory)
2017-10-14T03:46:06.9292283Z ##[debug]  d:\a\1\s\.gitignore (file)
[truncated]
2017-10-14T03:46:06.9292283Z ##[debug]  d:\a\1\s\nuget.config (file)
2017-10-14T03:46:06.9292283Z ##[debug]  d:\a\1\s\README.md (file)
2017-10-14T03:46:06.9292283Z ##[debug]  d:\a\1\s\src (directory)
2017-10-14T03:46:06.9302295Z ##[debug]  d:\a\1\s\src\docker-compose.ci.build.yml (file)
2017-10-14T03:46:06.9302295Z ##[debug]  d:\a\1\s\src\docker-compose.dcproj (file)
2017-10-14T03:46:06.9302295Z ##[debug]  d:\a\1\s\src\docker-compose.override.yml (file)
2017-10-14T03:46:06.9302295Z ##[debug]  d:\a\1\s\src\docker-compose.yml (file)
2017-10-14T03:46:06.9302295Z ##[debug]  d:\a\1\s\src\InitialProcessor.sln (file)
2017-10-14T03:46:06.9302295Z ##[debug]  d:\a\1\s\src\Spectre.Configuration (directory)
2017-10-14T03:46:06.9312287Z ##[debug]  d:\a\1\s\src\Spectre.Configuration\bin (directory)
2017-10-14T03:46:06.9312287Z ##[debug]  d:\a\1\s\src\Spectre.Configuration\bin\release (directory)
2017-10-14T03:46:06.9312287Z ##[debug]  d:\a\1\s\src\Spectre.Configuration\bin\release\netstandard2.0 (directory)
2017-10-14T03:46:06.9322287Z ##[debug]  d:\a\1\s\src\Spectre.Configuration\bin\release\netstandard2.0\publish (directory)
[truncated]
2017-10-14T03:46:07.0212244Z ##[debug]  d:\a\1\s\src\Spectre.InitialProcessor.TestConsole\Dockerfile (file)
2017-10-14T03:46:07.0212244Z ##[debug]  d:\a\1\s\src\Spectre.InitialProcessor.TestConsole\Dockerfile-Publish (file)
[truncated]
2017-10-14T03:46:07.0222242Z ##[debug]  d:\a\1\s\src\Spectre.InitialProcessor.TestConsole\Program.cs (file)
2017-10-14T03:46:07.0222242Z ##[debug]  d:\a\1\s\src\Spectre.InitialProcessor.TestConsole\Spectre.InitialProcessor.TestConsole.csproj (file)
2017-10-14T03:46:07.0222242Z ##[debug]389 results
2017-10-14T03:46:07.0222242Z ##[debug]patternRoot: 'd:\a\1\s'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.debug: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.nobrace: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.noglobstar: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.dot: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.noext: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.nocase: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.nonull: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.matchBase: 'true'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.nocomment: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.nonegate: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]matchOptions.flipNegate: 'undefined'
2017-10-14T03:46:07.0222242Z ##[debug]pattern: 'd:\a\1\a\**\Dockerfile-Publish'
2017-10-14T03:46:07.0222242Z ##[debug]expanding braces
2017-10-14T03:46:07.0222242Z ##[debug]pattern: 'd:/a/1/a/**/Dockerfile-Publish'
2017-10-14T03:46:07.0222242Z ##[debug]applying include pattern against original list
2017-10-14T03:46:07.0222242Z ##[debug]0 matches
2017-10-14T03:46:07.0222242Z ##[debug]0 final results
2017-10-14T03:46:07.0222242Z ##[debug]task result: Failed
2017-10-14T03:46:07.0222242Z ##[error]Unhandled: No Docker file matching  d:\a\1\a\**\Dockerfile-Publish  was found.
2017-10-14T03:46:07.0222242Z ##[debug]Processed: ##vso[task.issue type=error;]Unhandled: No Docker file matching  d:\a\1\a\**\Dockerfile-Publish  was found.
2017-10-14T03:46:07.0222242Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: No Docker file matching  d:\a\1\a\**\Dockerfile-Publish  was found.
2017-10-14T03:46:07.0312247Z ##[section]Finishing: Build an image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
laazikcommented, Jan 23, 2021

For those who are struggling with single solution multi project build setup in Azure pipeline for Docker. I had exactly the same issue, and if you look into the command line that the build server gives out you can see that it tries, by default, to make a build in the project directory.

So to fix this, you most likely need to add a buildContext: $(Build.SourcesDirectory) to the actual build file. This forces the Docker context to e.g. Solution level (because the Dockerfile copy commands are based on the solution level directory).

Probably worth adding to somewhere in the comments or smth.

0reactions
Daniel-Krzyczkowskicommented, Dec 16, 2022

For those who are struggling with single solution multi project build setup in Azure pipeline for Docker. I had exactly the same issue, and if you look into the command line that the build server gives out you can see that it tries, by default, to make a build in the project directory.

So to fix this, you most likely need to add a buildContext: $(Build.SourcesDirectory) to the actual build file. This forces the Docker context to e.g. Solution level (because the Dockerfile copy commands are based on the solution level directory).

Probably worth adding to somewhere in the comments or smth.

It works, thank you so much for help!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker task cannot find dockerfile in staging directory, #5641
I had the same issue. The docker compose file was not checked in for my solution which caused this error. Adding the file...
Read more >
The Docker build task cannot find the file referenced in the ...
I'm guessing the Docker task can't find the in the working directory? Is there a better way to reference the path in the...
Read more >
Docker - unable to prepare context: unable to evaluate ...
While executing the following command, docker build -t docker-whale . check that Dockerfile is present in your current working directory.
Read more >
Dockerfile reference - Docker Documentation
Dockerfile reference. Docker can build images automatically by reading the instructions from a Dockerfile . A Dockerfile is a text document that contains ......
Read more >
Build container images to deploy apps - Azure Pipelines
To build this image, all you need is a Dockerfile in your repository. ... For more information, see the Docker task used by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found