aws / aws-lambda-base-images

Apache License 2.0
648 stars 107 forks source link

find command not found starting from Python 3.9.2022.08.23.12 #58

Closed dsauchanka-boden closed 1 year ago

dsauchanka-boden commented 1 year ago

Python image 3.9.2022.08.23.12 introduced a regression in that it no longer contains command find. Earlier versions up until 3.9.2022.08.18.10 contained the command.

To reproduce, create this Docker file:

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

RUN find / -type f

and run docker build . --no-cache. The output is as follows:

Sending build context to Docker daemon  17.41kB
Step 1/2 : FROM public.ecr.aws/lambda/python:3.9.2022.08.23.16
3.9.2022.08.23.16: Pulling from lambda/python
d75a45812b7b: Pull complete
8c6364d653ee: Pull complete
e5fa1a45a81a: Pull complete
cdd8ca1359da: Pull complete
3294ac2f2147: Pull complete
869e8139f509: Pull complete
Digest: sha256:e58821c4a48a784602cdbc8d0dee45211f7348c753b17f756595a3a7172ebd16
Status: Downloaded newer image for public.ecr.aws/lambda/python:3.9.2022.08.23.16
 ---> fbfe741a3a81
Step 2/2 : RUN find / -type f
 ---> Running in e40c5b8cf804
/bin/sh: find: command not found
The command '/bin/sh -c find / -type f' returned a non-zero code: 127
GMarzinotto commented 1 year ago

I have the same problem with the older version

public.ecr.aws/lambda/python:3.8

Out of nowhere this stop working. If I create a simple container using this image and I try to docker exec find I get this error:

OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "find": executable file not found in $PATH: unknown

and if I check the environment variables, I have this:

PATH=/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin
HOSTNAME=c937b6cfc1df
TERM=xterm
LANG=en_US.UTF-8
TZ=:/etc/localtime
LD_LIBRARY_PATH=/var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib
LAMBDA_TASK_ROOT=/var/task
LAMBDA_RUNTIME_DIR=/var/runtime
HOME=/root

Maybe something is missing from the PATH?

justinmk3 commented 1 year ago

Related? https://github.com/aws/aws-lambda-base-images/issues/57

keshayad commented 1 year ago

Hi, Thanks for reporting and apologies for the issue. We are working on releasing the fix for this. Meanwhile the potential workaround is doing a yum update before using any of the utilities.

dev-dsk-keshayad-2a-b087bf3d % cat Dockerfile
FROM public.ecr.aws/lambda/python:3.9.2022.08.23.12

RUN yum update
RUN find --help

Logs:

dev-dsk-keshayad-2a-b087bf3d % docker build .
Sending build context to Docker daemon  361.3MB
Step 1/3 : FROM public.ecr.aws/lambda/python:3.9.2022.08.23.12
 ---> 65cf149ed525
Step 2/3 : RUN yum update
 ---> Using cache
 ---> 9012c3281390
Step 3/3 : RUN find --help
 ---> Running in 6dbd436cdff6
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:

operators (decreasing precedence; -and is implicit where no others are given):
      ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2
      EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2

positional options (always true): -daystart -follow -regextype

normal options (always true, specified before other expressions):
      -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
      --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race

tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
      -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
      -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
      -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
      -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
      -readable -writable -executable
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
      -used N -user NAME -xtype [bcdpfls]
      -context CONTEXT

actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
      -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
      -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;

Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.
Removing intermediate container 6dbd436cdff6
 ---> e583a938639b
Successfully built e583a938639b
keshayad commented 1 year ago

We've released set of new images for every runtime with the fix. Please consume the latest images.

Logs:

dev-dsk-keshayad-2a-b087bf3d % docker run -it --entrypoint sh public.ecr.aws/lambda/python:3.9.2022.08.26.15
Unable to find image 'public.ecr.aws/lambda/python:3.9.2022.08.26.15' locally
3.9.2022.08.26.15: Pulling from lambda/python
69b97305933b: Pull complete
8ca25f08af04: Pull complete
21df1b8cdc1f: Pull complete
cdd8ca1359da: Pull complete
196603b1f918: Pull complete
2b19dd6789f9: Pull complete
Digest: sha256:c434853c72d77f9401bd0b3118de598b3001a7bc6256618e324ecfa8fe741f4d
Status: Downloaded newer image for public.ecr.aws/lambda/python:3.9.2022.08.26.15
sh-4.2# find --help
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:

operators (decreasing precedence; -and is implicit where no others are given):
      ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2
      EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2

positional options (always true): -daystart -follow -regextype

normal options (always true, specified before other expressions):
      -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
      --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race

tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
      -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
      -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
      -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
      -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
      -readable -writable -executable
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
      -used N -user NAME -xtype [bcdpfls]
      -context CONTEXT

actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
      -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
      -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;

Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.
sh-4.2#