Home > OS >  Issue building docker image: Unable to locate package / command returns non-zero code 100
Issue building docker image: Unable to locate package / command returns non-zero code 100

Time:07-16

I am new to Docker. I used the following command to build an image but I get errors:

sudo docker build -t docker-custom-app .

Dockerfile:

FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y curl &&\
apt-get install -y python3 &&\
apt-get install -y python3-pip &&\
pip install flask &&\
pip install flask-mysql

COPY . /opt/source-code

ENTRYPOINT FLASK_APP=/opt/source-code/app.py flask run

The error I get:

E: Unable to locate package curl The command '/bin/sh -c apt-get update && apt-get upgrade -y &&apt-get install -y curl &&apt-get install -y python3 &&apt-get install -y python3-pip &&pip install flask &&pip install flask-mysql' returned a non-zero code: 100

even if I use another RUN command, e.g.

RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y software-properties-common &&\
pip install flask &&\
pip install flask-mysql

I get https://i.stack.imgur.com/0h3Cw.png

E: Unable to locate package software-properties-common The command '/bin/sh -c apt-get update && apt-get upgrade -y &&apt-get install -y software-properties-common &&pip install flask &&pip install flask-mysql' returned a non-zero code: 100

Or another RUN command example:

RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y python3 &&\
apt-get install -y software-properties-common &&\
pip install flask &&\
pip install flask-mysql

I get an error:

E: Unable to locate package python3 The command '/bin/sh -c apt-get update && apt-get upgrade -y &&apt-get install -y python3 &&apt-get install -y software-properties-common &&pip install flask &&pip install flask-mysql' returned a non-zero code: 100

I always get an error something like Unable to locate package/returned a non-zero code:100

Any help is appreciated. Thanks.

CodePudding user response:

apt-get update caused the issue, it didn't work. I think your docker installation is somehow broken or you installed docker in a wrong way. Maybe you are on mac.

  • Related