Docker build is giving me this error " /bin/sh: -c requires an argument , The command '/bin/sh -c' returned a non-zero code: 2"
I am creating a docker file for my messaging-app, Here is my dockerfile.
FROM python:3.9-alpine3.15
LABEL maintainer="Noor Ibrahim"
ENV PYTHONUNBUFFERED 1
COPY ./message /message
COPY ./requirements.txt /requirements.txt
WORKDIR /message
EXPOSE 8000
RUN
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
/py/bin/pip install -r /requirements.txt && \
adduser --disabled-password --no-create-home user
ENV PATH="/py/bin:$PATH"
USER user
I am running this command
docker build .
I am getting this error while creating the build. I have tried different things but this error doesn't go away.
Sending build context to Docker daemon 67.07kB
Step 1/11 : FROM python:3.9-alpine3.15
---> e49e2f1d4108
Step 2/11 : LABEL maintainer="Noor Ibrahim"
---> Using cache
---> 517b54d522ef
Step 3/11 : ENV PYTHONUNBUFFERED 1
---> Running in d8eb9d900584
---> 29e281514398
Step 4/11 : COPY ./message /message
---> f84edc508eec
Step 5/11 : COPY ./requirements.txt /requirements.txt
---> 608149cc5c42
Step 6/11 : WORKDIR /message
---> Running in b26ec4b33053
Removing intermediate container b26ec4b33053
---> c608a04f1993
Step 7/11 : EXPOSE 8000
---> Running in 8b4f7f49a3b8
Removing intermediate container 8b4f7f49a3b8
---> a18f155d9320
Step 8/11 : RUN
---> Running in 6fa80a39c7d0
/bin/sh: -c requires an argument
The command '/bin/sh -c' returned a non-zero code: 2
Almost certainly that extra RUN
line with no command after it
EXPOSE 8000
RUN <==== This one!!
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
/py/bin/pip install -r /requirements.txt && \
adduser --disabled-password --no-create-home user
Get rid of that and it should be fine.