Im trying to build docker image example from https://docs.docker.com/compose/gettingstarted/. And I got this error
Building web
Step 1/9 : FROM python:3.7-alpine
---> e854017db514
Step 2/9 : WORKDIR /code
---> Using cache
---> e15b6e62d8af
Step 3/9 : ENV FLASK_APP app.py
---> Using cache
---> 759c4bc8b254
Step 4/9 : ENV FLASK_RUN_HOST 0.0.0.0
---> Using cache
---> 6d40793f3089
Step 5/9 : RUN apk add --no-cache gcc musl-dev linux-headers
---> Running in 5e40bd670f1b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz: Permission denied
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz: Permission denied
ERROR: unsatisfiable constraints:
gcc (missing):
required by: world[gcc]
linux-headers (missing):
required by: world[linux-headers]
musl-dev (missing):
required by: world[musl-dev]
ERROR: Service 'web' failed to build: The command '/bin/sh -c apk add --no-cache gcc musl-dev linux-headers' returned a non-zero code: 3
This is my Dockfile
FROM python:3.7-alpine
WORKDIR /code
ENV FLASK_APP app.py
ENV FLASK_RUN_HOST 0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
CMD ["flask", "run"]
Can enyone help me solve this error ? Thank All !!!
Did the package you want to install move to a different registry?
Sometimes the packages that are being installed are moved from different registry branches. The default Docker Alpine image only has certain registries set. Adding additional registries expands your installation options (YMMV); I can't speak to the stability, security, and or risks associated with different registry branches. This thread helped me.
Failed Attempt & Error Message:
earlier in the log
Solutioning
package <package name>
Which type of memory am I using?
On the page for the packages select the proper link. so in my case:
Reading the information on that page I see that under Download the binary for this package is in presently part of
http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/cowsay-3.04-r0.apk
Comparing this to clue #2, I see that the alpine container is not referencing the registry with the binary I want to install.
Success & TL;DR;
Adding a package previously not found to alpine by adding additional registry to docker alpine container.
I'll add the registry that I need to find the package I want to install (step #3). In the code block below see that the third registry matches the initial part of the URL from the research done in part #3. I don't want to replace the existing registries (clue #2) so I set those again. I don't know if this is necessary or not but I did it anyway.
Dockerfile example
After building this file: