aws / aws/aws-lambda-base-images

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

Open
#156 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
777
Forks
118
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.