Open Stadzior opened 1 year ago
At least your dockerfilePath
is wrong. ImageBuildParameters.Dockerfile
is relative to the Dockerfile inside the tarball. It is also the file path to the Dockerfile
, not just the parent directory. BuildImageFromDockerfileAsync
runs fine in our tests.
@HofmeisterAn right. Removing Dockerfile from ImageBuildParameters leaded me to another error:
ADD failed: file not found in build context or excluded by .dockerignore: stat test.txt: file does not exist.
Can you please give me an example on how you build your tarball? I bet my method is somehow invalid and that's why test.txt is not found.
Accordingly to your other questions in the past days you might wanna take a look at Testcontainers. It looks like it covers everything you are trying to implement.
Can you please give me an example on how you build your tarball?
Here you go.
ImageBuildParameters.Dockerfile is relative to the Dockerfile inside the tarball. It is also the file path to the Dockerfile
Can you explain what that means? How can a path to a file in a file system be relative to a file in a tarball?
BuildImageFromDockerfileAsync runs fine in our tests.
Where can I find these tests? I don't see any calls to any BuildImageFromDockerfileAsync()
override in the test
project.
Can you explain what that means? How can a path to a file in a file system be relative to a file in a tarball?
To build a Docker image, the Docker daemon receives a tarball that contains all necessary files. The Dockerfile arg represents the path inside the tarball.
Where can I find these tests? I don't see any calls to any
BuildImageFromDockerfileAsync()
override in thetest
project.
It is part of Testcontainers for .NET.
Thanks for the clarification! Also, sorry -- I thought you were referring to the Docker.DotNet tests.
Output of
dotnet --info
:What version of Docker.DotNet?:
Steps to reproduce the issue: Just run below code as a ConsoleApp (ofc. you need docker deamon running):
Source directory content: Dockerfile:
test.txt:
What actually happened?: BuildImageFromDockerfileAsync went through without an error and there is no "myimage" visible under
docker image list
.What did you expect to happen?: "myimage" visible under
docker image list
Additional information: