Exec: "bash": executable file not found in $PATH: unknown

% docker run -it public.ecr.aws/lambda/python:3.9 bash
– works great !
% docker run -it aws-python3.9:local bash
– Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: “bash”: executable file not found in $PATH: unknown.

what could possibly be happening? I am using pyenv to define the python version and venv to manage the packages.

I am trying to use the following repo

to execute the following steps

% echo $PATH
/Users/abc/.pyenv/shims:/Users/abc/.pyenv/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/bin/docker:/Applications/Docker.app/Contents/Resources/bin

It seems bash is not included in the image, try sh for a simple shell.

1 Like

thanks for the response @bluepuma77 ! Unfortunately

docker run -it aws-python3.9:local sh

resulted in the same $PATH error.

There is no guarantee that an image has any kind of shell. It could contain a single binary or in your case possibly just the python interpreter and dependencies. Just check the source dockerfile

It is based on scratch, meaning it is an empty image and some content is addedd as separate tar files, so we can’t tell what it does, but it seems there is no shell in the image since it does not need one.

EDIT:

I see the tutorial shows running bash in the container. Maybe you should try to contact the author or open a n issue in the GitHub repo. I won’t build an image that will container unknown files.

1 Like

thanks for the response, @rimelek – I solved this by launching a fresh EC2 with the Amazon Linux platform, where Docker worked as designed. Thanks for your attention.