terraform-provider-docker: Failure to build docker image on MacOs

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

I am running: OS: MacOs TF: v1.2.7 Go: v1.19 Docker Provider : v2.20.2

Affected Resource(s)

  • docker_registry_image

Terraform Configuration Files

You can run the following example to reproduce the issue on MacOs : https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/container-image

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
# The code should be runnable for maintainers to reproduce the problem.
# We can't reproduce the problem with partial code.
# Don't include unknown input variables, local values, resources, etc.
# If you can reproduce the problem with public Docker images, please don't use private Docker images.
# Don't include unneeded resources to reproduce the problem.
# Don't set unneeded attributes to reproduce the problem.

Debug Output

Panic Output

Expected Behaviour

Docker Image should have been built and pushed to ECR.

Actual Behaviour

When triggering the exec, I ended up with the following error message:

╷ │ Error: Error building docker image: 0: failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 1: unknown instruction: PAXHEADERS.0/DOCKERFILE0000000000000000000000000000002100000000000012204 │ │ with module.docker_image.docker_registry_image.this, │ on …/…/modules/docker-build/main.tf line 12, in resource “docker_registry_image” “this”: │ 12: resource “docker_registry_image” “this” { │

Steps to Reproduce

  1. Clone the following repo https://github.com/terraform-aws-modules/terraform-aws-lambda locally
  2. cd into examples/container-image
  3. run terraform apply

Important Factoids

I am running on MacOs.

Building the image manually through docker build works seamlessly.

I also tested the example on an Amazon Linux 2 Instance and it’s also working.

References

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 7
  • Comments: 18 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I’m also experiencing issues with this on MacOS. Is there any chance of the fix submitted under https://github.com/kreuzwerker/terraform-provider-docker/pull/461 being merged sometime soon?

I am also running on MacOS with the exact same docker version output and it (the example you are both using) is running fine for me. Could you both post your docker daemon settings?

I just tested this by checking out the repository and performing the steps described in https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/container-image and it worked

Can you post the output of docker version here? And also maybe update your terraform to the newst version? It feels like your docker server backend somehow cannot correctly parse the Dockerfile in order to build the final image.