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

Bug: "Unable to find Local Image" #7824

Open
caleb-lyceum opened this issue Jan 8, 2025 · 2 comments
Open

Bug: "Unable to find Local Image" #7824

caleb-lyceum opened this issue Jan 8, 2025 · 2 comments
Labels
area/docker blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@caleb-lyceum
Copy link

Description:

Hello, I am trying to run my docker image with SAM CLI however it is not finding my local docker image that I reference in my template.

Steps to reproduce:

Create a SAM template using a docker image and docker image URI that references a local image, sam build, sam local invoke and it is not finding my local docker image.

Observed result:

2025-01-08 10:33:33,299 | No config file found in this directory.
2025-01-08 10:33:33,301 | OSError occurred while reading TOML file: [Errno 2] No such file or directory:
'/Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/samconfig.toml'
2025-01-08 10:33:33,302 | Config file location: /Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/samconfig.toml
2025-01-08 10:33:33,302 | Config file '/Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/samconfig.toml' does not exist
2025-01-08 10:33:33,304 | Using SAM Template at /Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/.aws-sam/build/template.yaml
2025-01-08 10:33:33,317 | OSError occurred while reading TOML file: [Errno 2] No such file or directory:
'/Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/samconfig.toml'
2025-01-08 10:33:33,318 | Using config file: samconfig.toml, config environment: default
2025-01-08 10:33:33,318 | Expand command line arguments to:
2025-01-08 10:33:33,318 | --template_file=/Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/.aws-sam/build/template.yaml --no_event
--layer_cache_basedir=/Users/calebanderson/.aws-sam/layers-pkg --container_host=localhost --container_host_interface=127.0.0.1
2025-01-08 10:33:33,319 | local invoke command is called
2025-01-08 10:33:33,373 | No current session found, using default AWS::AccountId
2025-01-08 10:33:33,374 | No Parameters detected in the template
2025-01-08 10:33:33,385 | There is no customer defined id or cdk path defined for resource LambdaFunction, so we will use the resource logical id as the resource id
2025-01-08 10:33:33,386 | 0 stacks found in the template
2025-01-08 10:33:33,386 | No Parameters detected in the template
2025-01-08 10:33:33,394 | There is no customer defined id or cdk path defined for resource LambdaFunction, so we will use the resource logical id as the resource id
2025-01-08 10:33:33,394 | 1 resources found in the stack
2025-01-08 10:33:33,395 | Found Serverless function with name='LambdaFunction' and ImageUri='pdf-splitter:latest'
2025-01-08 10:33:33,395 | --base-dir is not presented, adjusting uri . relative to
/Users/calebanderson/Documents/source/lyceum/ellie-api/functions/split_pdfs/.aws-sam/build/template.yaml
2025-01-08 10:33:33,396 | Skip Building LambdaFunction function, as it is missing either Dockerfile or DockerContext metadata properties.
2025-01-08 10:33:33,402 | Found one Lambda function with name 'LambdaFunction'
2025-01-08 10:33:33,403 | Invoking Container created from pdf-splitter:latest
2025-01-08 10:33:33,403 | Loading AWS credentials from session with profile 'None'
2025-01-08 10:33:33,408 | Code None is not a zip/jar file
2025-01-08 10:33:33,414 | Local image was not found.
2025-01-08 10:33:33,415 | Removing rapid images for repo pdf-splitter
Building image.........
2025-01-08 10:33:33,633 | Failed to build Docker Image

Expected result:

I would expect that SAM is able to properly locate the docker image and build my lambda function with that.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Mac OS sequoia 15.1.1 (arm64)
  2. sam --version: 1.132.0
  3. AWS region: us-east-1
{
  "version": "1.132.0",
  "system": {
    "python": "3.11.10",
    "os": "macOS-15.1.1-arm64-arm-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "27.3.1",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
@caleb-lyceum caleb-lyceum added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Jan 8, 2025
@caleb-lyceum
Copy link
Author

Output of docker images | grep pdf-splitter:

pdf-splitter                              latest                                 adbe24222e13   17 minutes ago   7.09GB

@roger-zhangg
Copy link
Member

Thanks for reporting, could you try restarting the docker daemon. and sam build --no-cache. If the error remains, could you help to share your template.yaml? Thanks

@roger-zhangg roger-zhangg added area/docker blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docker blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

2 participants