Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question/Problem with docker_image input #219

Closed
JCapriotti opened this issue Oct 22, 2021 · 5 comments
Closed

Question/Problem with docker_image input #219

JCapriotti opened this issue Oct 22, 2021 · 5 comments

Comments

@JCapriotti
Copy link

Description

I'm wondering why specifying docker_image inconsistently requires either docker_build_root or docker_file to be provided. It seems that docker_image works without the other inputs only if the image is already stored locally.

Versions

  • Terraform:
    Terraform v1.0.9
    on darwin_amd64
    
  • Providers:
    + provider registry.terraform.io/cyrilgdn/postgresql v1.14.0
    + provider registry.terraform.io/hashicorp/aws v3.61.0
    + provider registry.terraform.io/hashicorp/external v2.1.0
    + provider registry.terraform.io/hashicorp/http v2.1.0
    + provider registry.terraform.io/hashicorp/local v2.1.0
    + provider registry.terraform.io/hashicorp/null v3.1.0
    + provider registry.terraform.io/hashicorp/random v3.1.0
    
  • Module:
    2.22.0
    

Reproduction

Using these Docker-related inputs (no other docker inputs) AND if you have not pulled the Docker image locally.

build_in_docker   = true
docker_image      = "public.ecr.aws/sam/build-python3.9:latest"

Expected behavior

The Docker image is used for the packaging without error.

Actual behavior

Error:

ValueError: docker_build_root or docker_file must be provided

Terminal Output Screenshot(s)

image

Additional context

This seems to be caused by a call to docker images <tag>.

If the image is found, ok is set to True and docker_build_command is (correctly) never called, which is the method that is raising the error.

This seems like a bug, but I'm not sure of the intent for that block of code.

@JCapriotti JCapriotti changed the title Question about docker_image input Question/Problem with docker_image input Oct 22, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Jan 11, 2022
@github-actions
Copy link

This issue was automatically closed because of stale in 10 days

@bellis-ai
Copy link

This is still a valid problem. Why the image needs to be pre-pulled is beyond me.

@bellis-ai
Copy link

If anyone else is encountering this problem and has something like a pipeline where they don't want to add download steps on every apply, use a barebones dockerfile that is "FROM" the image you want

i.e.

FROM "public.ecr.aws/sam/build-python3.9" 

mwiede pushed a commit to mwiede/terraform-aws-lambda that referenced this issue Oct 6, 2022
mwiede pushed a commit to mwiede/terraform-aws-lambda that referenced this issue Oct 22, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants