Home > Software design >  Docker failed to solve: executor failed running. exit code: 1
Docker failed to solve: executor failed running. exit code: 1

Time:09-12

I am trying to dockerize my Django project with the following Dockerfile.

Dockerfile

FROM python:3.9-bullseye

WORKDIR /app

ENV PYTHONUNBUFFERED=1

COPY . .

RUN apt-get update \
    && apt-get upgrade pip \
    && pip install --upgrade pip \
    && pip lock -r > requirements.txt \
    && pip install -r requirements.txt

CMD ["ls"]

Error

#0 5.012 41 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
#0 5.012 Need to get 28.9 MB of archives.
#0 5.012 After this operation, 32.4 MB of additional disk space will be used.
#0 5.012 Do you want to continue? [Y/n] Abort.
------
failed to solve: executor failed running [/bin/sh -c apt-get update 
    && apt-get upgrade pip     && pip install --upgrade pip     && 
pip lock -r > requirements.txt     && pip install -r 
requirements.txt]: exit code: 1

I am getting this error trying to docker-compose up. I think it's because of incorrect command inputs of python:3.9-bullseye distribution. I am new to Docker and trying to figure out what the Linux commands are. Please help me correct this.

CodePudding user response:

By checking the log output

#0 7.873 Do you want to continue? [Y/n] Abort.

You should pass the flag -y in order to auto accept the installation of packages in apt related commands.

So you should try something like this

RUN apt-get update -y \
    && apt-get upgrade -y pip \
    && pip install --upgrade pip \
  • Related