Reputation: 21
I've been creating scrapping python scripts and uploading them using a Dockerfile image, into AWS ECR. Then I load the image into AWS Lambda for running and being able to call the Lambda function from a route in a web app.
While im testing the code, I have build, uploaded and use the image several times in the last few weeks. The base image is public.ecr.aws/lambda/python:3.11, and I had no problem until today.
The beginning of my dockerfile:
# Start with the base image
FROM public.ecr.aws/lambda/python:3.11 as build
# Install system-level dependencies for Chrome and FFmpeg
RUN yum install -y unzip atk cups-libs gtk3 libXcomposite alsa-lib \
libXcursor libXdamage libXext libXi libXrandr libXScrnSaver \
libXtst pango at-spi2-atk libXt xorg-x11-server-Xvfb \
xorg-x11-xauth dbus-glib dbus-glib-devel nss mesa-libgbm git
The terminal command im using:
docker build --platform=linux/amd64 -t [name_of_my_image]
The error I am getting:
=> ERROR [ 2/16] RUN yum install -y unzip atk cups-libs gtk3 libXcomposite alsa-lib
ERROR: failed to solve: process "/bin/sh -c yum install -y unzip atk cups-libs gtk3 libXcomposite alsa-lib
What I think it is: I believe YUM might not be installed in the python:3.11. But it is very wierd because it worked this last couple of weeks.
PC/Technical details: Running on MacBook Pro M2. Using VSC for most of the code. Terminal running on both zsh and bash generate the same error. Docker desktop version 4.25.2. Docker engine 24.0.6. Compose: v2.23.0-desktop.1
Because I thought it could be the base image I changed it to an older version. I used the following image.
Python:3.9 image:
FROM public.ecr.aws/lambda/python:3.9 as build
Which passed the YUM install line and continued building the dockerfile as usual.
Although it works on Python:3.9 image, I wish to know what happened to avoid it happening again. I thought that by defining the image as 3.11
instead of latest
I would avoid this sort of issues.
Upvotes: 1
Views: 2731
Reputation: 21
As Anon Coward mentioned in the comment the image was broken by a recent change moving the base from Amazon Linux 2 to Amazon Linux 2023.
It appears that an update that was supposed to only affect python 3.12 affected python 3.11 images as well.
Someone who might work at AWS mentioned that a fix was coming in this Github. AWS also states that dnf
is replacing yum
but no dnf
exists within the 3.11 image.
Current solutions:
yum
exists.public.ecr.aws/lambda/python:3.11.2023.11.18.02
dnf
instead of yum
in 3.12 (Not tested by me)yum
manually (Not recommended)UPDATE: "And you can now pull the latest 3.11 image, it fixes this issue and yum once again works." – Anon Coward
Upvotes: 0