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

Docker build error with exec: "/bin/sh": stat /bin/sh: no such file or directory #156

Open
codeloversa opened this issue Apr 5, 2024 · 0 comments

Comments

@codeloversa
Copy link

codeloversa commented Apr 5, 2024

I have build the base image for python3.9 by the instructions in the readme.

but when I reference the image to build another docker images, there is a build error:

" > [2/8] RUN mkdir -p /function:
0.278 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
Dockerfile_aws_lambda:10
--------------------
   8 |     
   9 |     # Copy function code
  10 | >>> RUN mkdir -p ${FUNCTION_DIR}
  11 |     COPY ./lambda_function.py ${FUNCTION_DIR}
  12 |     COPY ./Pipfile* ${FUNCTION_DIR}
--------------------
ERROR: failed to solve: process "/bin/sh -c mkdir -p ${FUNCTION_DIR}" did not complete successfully: exit code: 1
"

FYI, here is my docker file


"# Define custom function directory
ARG FUNCTION_DIR="/function"

FROM python3.9:local

# Include global arg in this stage of the build
ARG FUNCTION_DIR

# Copy function code
RUN mkdir -p ${FUNCTION_DIR}
COPY ./lambda_function.py ${FUNCTION_DIR}
COPY ./Pipfile* ${FUNCTION_DIR}
COPY ./pip.conf /etc/pip.conf

WORKDIR ${FUNCTION_DIR}

# Install the pipevn
RUN python -m pip install pipenv==2022.4.21

#Install the dependencies and create virtual environment at currently folder
RUN PIPENV_PIPFILE=./Pipfile PIPENV_VENV_IN_PROJECT=1 pipenv install

ENTRYPOINT [ "/.venv/bin/python", "-m", "awslambdaric" ]

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "lambda_function.handler" ]"

Could you give some advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant