testcontainers / testcontainers/testcontainers-java
.dockerignore file is not honored by ImageFromDockerfile
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
For Docker build performance, it can be very important for certain projects to have a .dockerignore file so that extra content is not sent to the Docker daemon (which may be on a different machine).
It appears that the underlying docker-java API does support .dockerignore files:
https://github.com/docker-java/docker-java/blob/master/src/test/java/com/github/dockerjava/cmd/BuildImageCmdIT.java#L176
However, if I try an invalid .dockerignore in one of my Testcontainers projects, then it does not appeared to be honored. I was able to confirm this with the following steps:
- Add invalid content in a
.dockerignorefile like this:
*~
[a-b-c]
- Run
docker build .and verify it fails - Run equivalent command through TC API and it passes (it should fail due to invalid syntax)
new ImageFromDockerfile()
.withFileFromPath(".", Paths.get(".")))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ImageFromDockerfile and compare its file-transfer behavior with the docker-java BuildImageCmdIT.java test linked in the issue. Reproduce the invalid .dockerignore example through both docker build . and the Testcontainers API. Done means the API honors .dockerignore syntax and rejects the invalid pattern as Docker does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- devops, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100