You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Error building docker image: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile
Steps to Reproduce
terraform init
terraform apply -auto-approve
Important Factoids
The error only occurs when using the white-list pattern in the .dockerignore file. This implies to me that something is wrong with the * interpretation / pattern in the module.
The text was updated successfully, but these errors were encountered:
This issue is stale because it has been open 60 days with no activity.
Remove stale label or comment or this will be closed in 7 days.
If you don't want this issue to be closed, please set the label pinned.
I think the actual issue is that Dockerfiles must not be excluded before being passed to the API. I ran into a similar issue today (docker build worked fine, but missing Dockerfiles when using this provider) and finally resolved it by changing .dockerignore to not exclude Dockerfiles.
If you take a look at the CLI code, you can see it's excluding Dockerfile and .dockerignore before passing them to the API, along with a bunch of other complicated logic that has no equivalent in the provider. My guess is we need to implement something similar in order for this provider to behave more comparably to docker build.
Specifically what seems to not be implemented in the terraform docker provider is this:
You can even use the .dockerignore file to exclude the Dockerfile and .dockerignore files. These files are still sent to the daemon because it needs them to do its job. But the ADD and COPY instructions do not copy them to the image.
Community Note
Terraform (and docker Provider) Version
Terraform v1.0.2
Affected Resource(s)
docker_registry_image
Terraform Configuration Files
Folder structure:
empty
.dockerignore
Dockerfile
main.tf
Debug Output
Expected Behaviour
Successfully build and publish image to registry.
Actual Behaviour
Steps to Reproduce
terraform init
terraform apply -auto-approve
Important Factoids
.dockerignore
file. This implies to me that something is wrong with the*
interpretation / pattern in the module.The text was updated successfully, but these errors were encountered: