better-park-50917
03/29/2023, 11:02 AMerror: failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount1744191223/myapp.api\Dockerfile: no such file or directory
folder structure
src
-- myapp.api
----- Dockerfile
-- myapp.api.contracts
-- deploy (Pulumi c#)
----- Pulumi.yml
----- deploy.csproj
-- myapp.sln
c# code
var apiImage = new Image("api-image", new()
{
Build = new DockerBuildArgs
{
Context = "..",
Dockerfile = "..\\myapp.api\\Dockerfile",
Platform = "linux/amd64",
},
ImageName = repo.RepositoryUrl,
Registry = new RegistryArgs
{
Server = repo.RepositoryUrl,
Username = username,
Password = password
}
});
Any suggestions what's wrong? I'm using Windows machine (powershell)melodic-tomato-39005
03/29/2023, 3:35 PM/
instead of \\
? Forward-slashes work on Windows, too, and some tools expect thembetter-park-50917
03/30/2023, 6:11 AMvar apiImage = new Image("api-image", new()
{
Build = new DockerBuildArgs
{
Context = "..",
Dockerfile = "../myapp.api/Dockerfile",
Platform = "linux/amd64",
},
ImageName = repo.RepositoryUrl,
Registry = new RegistryArgs
{
Server = repo.RepositoryUrl,
Username = username,
Password = password
}
});
and got error
error: error hashing dockerfile "../myapp.api/Dockerfile": could not open file ../myapp.api/Dockerfile: open ..\..\myapp.api\Dockerfile: The system cannot find the path specified.
fresh-spring-82225
04/03/2023, 8:00 PMbuild: {
context: imageDir,
dockerfile: `${imageDir}\\Dockerfile`
}
build: {
context: imageDir
}
or
build: {
context: imageDir,
dockerfile: `${imageDir}/Dockerfile`
}
buildImage
twice, in order to tag the image with both latest
and a hash. When I call buildImage
the 2nd time, fails with this error (where imageDir
is test-image
):
error: error hashing dockerfile "test-image/Dockerfile": could not open file test-image/Dockerfile: open test-image\test-image\Dockerfile: The system cannot find the path specified.
dockerfile:`${imageDir}\\Dockerfile`
${_imageDir_}/Dockerfile
it doesn't work on Windows -- it works fine on Mac OS.imageDir
to an absolute path