Lambda image is invalid

0

I have been using the same lambda image using AWS's python 3.8 as base image for a while. During last minor code change the created image is no longer associable with the lambda. It gives the error "The image provided is invalid". I have tried multiple ways by creating new lambda, new image created on standalone machine etc. the container runs locally if I change the Entrypoint and execute the file with in the container

Dockerfile:

FROM public.ecr.aws/lambda/python:3.8

RUN yum update -y RUN python -m pip install --upgrade pip COPY requirements.txt requirements.txt RUN pip install -r requirements.txt RUN yum -y install git RUN curl https://packages.microsoft.com/config/rhel/6/prod.repo > /etc/yum.repos.d/mssql-release.repo RUN ACCEPT_EULA=Y yum install -y msodbcsql17 RUN ACCEPT_EULA=Y yum install -y mssql-tools RUN yum install -y unixODBC-devel COPY . . CMD [ "app.lambda_handler" ]

1 Answer
0

Dockerfile Syntax: ensure that your Dockerfile has the correct syntax. There is a missing backslash at the end of the RUN yum update -y line. Check your image tag Ensure that you are using a valid tag for the base image (public.ecr.aws/lambda/python:3.8). AWS Lambda periodically updates their base images, so make sure the tag is correct

FROM public.ecr.aws/lambda/python:3.8

RUN yum update -y \
    && python -m pip install --upgrade pip \
    && pip install -r requirements.txt \
    && yum -y install git \
    && curl https://packages.microsoft.com/config/rhel/6/prod.repo > /etc/yum.repos.d/mssql-release.repo \
    && ACCEPT_EULA=Y yum install -y msodbcsql17 \
    && ACCEPT_EULA=Y yum install -y mssql-tools \
    && yum install -y unixODBC-devel

COPY . .

CMD [ "app.lambda_handler" ]

Check CloudWatch Logs for the Lambda function for any error messages or logs that might provide insights into the issue and also ensure that you are using a recent version of the AWS CLI
aws --version AWS Lambda has a maximum image size limit. Ensure that your Docker image size does not exceed this limit :- https://repost.aws/questions/QUPfIJnXi3RfOWTH3P24P9YA/what-is-the-maximum-size-for-a-lambda-docker-image

Hope it clarifies and if does I would appreciate answer to be accepted so that community can benefit for clarity, thanks ;)

profile picture
answered 23 days ago
  • The backslash isnt missing, its just not been correctly formatted when pasting into the question. The RUN is on a new line and therefore the backslash isnt required

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions