terraform-provider-docker: Image build fails if it takes longer than 20 minutes
Community Note
- Please vote on this issue by adding a π reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave β+1β or βme tooβ comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform (and docker Provider) Version
Terraform v1.0.3 on darwin_amd64
- provider registry.terraform.io/kreuzwerker/docker v2.14.0
Affected Resource(s)
docker_imagedocker_registry_image
Expected Behaviour
The image is built by Terraform.
Actual Behaviour
...
module.foo.docker_registry_image.this["pytorch-gpu"]: Still creating... [19m50s elapsed]
β·
β Error: Error building docker image: context deadline exceeded
β
β with module.foo.docker_registry_image.this["pytorch-gpu"],
β on ../main.tf line 153, in resource "docker_registry_image" "this":
β 153: resource "docker_registry_image" "this" {
β
β΅
Steps to Reproduce
Try to build a Docker image in Terraform for the following Dockerfile:
FROM busybox:latest
RUN sleep 1201
Important Factoids
The timeout includes the uploading of the image.
Building a Docker image for a data science environment usually means downloading or compiling big software packages (Pytorch+CUDA in my case) that result in 2-6 Gb images. The time of building and uploading such a image sometimes exceeds 20 minutes.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 11
- Comments: 16 (1 by maintainers)
We might need a separate
timeoutblock: https://www.terraform.io/docs/language/resources/syntax.html#operation-timeoutsOh, I forgot about this one. I will have a look the next week.
This seems like a trivial change. I havenβt contributed to this repo but if no one is looking into the issue, I might try.
The timeout itself comes from https://github.com/hashicorp/terraform-plugin-sdk/blob/112e2164c381d80e8ada3170dac9a8a5db01079a/helper/schema/resource_data.go#L409-L415.
I could reproduce the similar error with
docker_imageresource.docker version
main.tf
Dockerfile
Debug log: https://gist.github.com/suzuki-shunsuke/1e56152acad81333cbab0b47bc6fa92b
https://github.com/kreuzwerker/terraform-provider-docker/blob/934bc2935f6cf0890a222c6c8acbbca7cd56739b/internal/provider/resource_docker_image_funcs.go#L38-L40
https://github.com/kreuzwerker/terraform-provider-docker/blob/934bc2935f6cf0890a222c6c8acbbca7cd56739b/internal/provider/resource_docker_image_funcs.go#L150-L153
But I canβt find the timeout setting.