I'm building manually docker images from .NET 6 projects on Windows and uploading them to a docker container registry in Azure.
I'm in the folder with the dockerfile and run:
az acr build --registry MyContainerRegistry --image project/imagename:v1 .
And receive the following error message:
Packing source code into tar to upload...
[WinError 3] The system cannot find the path specified: '.\\some_directory_hierarchy\\obj\\Debug\\netcoreapp3.1\\OneOfMyProjects.GeneratedMSBuildEditorConfig.editorconfig'
The dockerfile has no reference to this file, and AFAIK editorconfig isn't needed in the build process. From the first line, I can tell that no step defined in the docker file is run.
Just to highlight:
- I am logged in to Azure
- The same way I'm doing it worked with multiple docker images in the same project when uploading to the same registry.
- When using
docker build
on the same dockerfile the process runs and finishes successfully.
Why az acr build
does not work?
It appears that the build process is attempting to include a file (
OneOfMyProjects.GeneratedMSBuildEditorConfig.editorconfig
) in the source code tarball that might not be necessary for the Docker build..dockerignore
file to exclude unnecessary files or directories. Create a file named.dockerignore
in the same directory as your Dockerfile and list files or patterns to excludeHere, I have a
image
in my ACR pushed from my Docker desktop. After the above changes, I can run theaz acr build
as expected.az acr build --registry testregdec7 --image my-sample-app .