Docker alpine apk cannot find git-lfs package - docker

I'm trying to install git-lfs in a Docker alpine image, but I'm getting an error indicating:
ERROR: unsatisfiable constraints:
git-lfs (missing):
required by: world[git-lfs]
It seems that there has been many issues related to apk not finding packages (see here and there), and in many cases these have been solved by using the --no-cache option with apk add. But I am not being that lucky and cannot understand the origin of this error, specially considering that git-lfs is up to date in alpine repo.
The following small Dockerfile should reproduce the error:
FROM alpine:3.4
RUN apk update && apk add --no-cache \
build-base \
git \
git-lfs

The problem is that git-lfs is available only from alpine:3.7.
To fix the issue you should either rebuild it on your own or use an alpine version >=3.7.
Btw, you don't need to execute apk update.

Related

Docker throwing ERROR: unsatisfiable constraints whenever I try to build GetTogether

'Sup fam, I'm trying to build a site using GetTogether and I'm following the instructions herein: https://github.com/GetTogetherComm/GetTogether
Everything has went okay so far; I had to use python3 -m for some of the python commands, but other than that the build went fine.
Then I tried to build the Docker image.
It does not want to build the Docker image.
This is what happens when I try to build the Docker image:
Sending build context to Docker daemon 74.93MB
Step 1/19 : FROM python:3-alpine as builder
---> 872c3118ec53
Step 2/19 : WORKDIR /home/python
---> Using cache
---> 203fb3a9909b
Step 3/19 : RUN apk add --no-cache zlib-dev build-base python-dev jpeg-dev
---> Running in 87f4f8436424
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
python-dev (missing):
required by: world[python-dev]
The command '/bin/sh -c apk add --no-cache zlib-dev build-base python-dev jpeg-dev' returned a non-zero code: 1
I tried everything. I tried Googling for these supposed missing packages. I tried bribery. I tried singing gentle lullabies to it and rubbing its back. I even gave it some of my weed. Nothing makes it work. NOTHING.
Please help. For my sanity. For my weed stash.
Use python3-dev instead of python-dev found here

Docker Alpine Linux python (missing)

I have a pipeline which deploys my container from GitLab. Last deployment was 5 days ago and went without any problems. Today I deploy it and get the following error:
$ apk add --no-cache curl python py-pip
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
python (missing):
required by: world[python]
My job definition is:
my-deploy:
type: my-deploy
image: docker:stable
script:
- apk update
- apk add --no-cache curl python py-pip <-- Here the erorr happens
...
From this issue on the Docker's repo:
This was "broken" while updating our base from alpine:3.11 to alpine:3.12.
In order to fix it you need to specify the version of Python directly, e.g.:
apk add python2
// or
apk add python3
Try this command:
apk add --update --no-cache curl py-pip
It will install python3 automatically with pip.
My understanding is that Python 2 has been decommissioned from the latest Alpine packages.
For future readers:
I got a similar error with node:14-alpine
ERROR: unable to select packages:
python2 (no such package):
required by: world[python2]
But I couldn't use the other answers listed in this question because I needed exactly python2 and running apk add python2 was giving me the error above.
After a while I realized that in the latest alpine version, there's only python3 (there's no python2).
So the solution was to use an older version of alpine that have python2 (alpine v3.15).
So the fix was changing node:14-alpine to node:14-alpine3.15
I know this isn't the exact same error, but while trying to find an answer for my error, I always ended up here, so I'm leaving this for future readers that might have the same problem.
I've fix following this
https://gitlab.alpinelinux.org/alpine/aports/-/issues/11605
Updating your code to install python3:
before_script:
- apk add --update --no-cache curl jq py3-configobj py3-pip py3-setuptools python3 python3-dev
What solved it for me is this solution posted on GitHub.
RUN echo -e "http://nl.alpinelinux.org/alpine/v3.5/main\nhttp://nl.alpinelinux.org/alpine/v3.5/community" > /etc/apk/repositories

Alpine package py3-scipy is missing

I'm in an alpine linux docker container, and I'm trying to install py3-scipy. Here is info on that package: https://pkgs.alpinelinux.org/package/edge/community/x86/py3-scipy. I want to do this because pip install scipy takes way too long.
Here is what I get:
/ # apk add py3-scipy
ERROR: unsatisfiable constraints:
py3-scipy (missing):
required by: world[py3-scipy]
My Dockerfile:
FROM alpine:3.9
RUN apk add --update python3-dev g++ gcc libxslt-dev cython lapack-dev gfortran build-base py3-scipy
What is causing this error?
I think this issue sometimes happen when alpine moves a package from edge/testing to edge/community so old versions of alpine will keep referring to the old url. So you need to try to use the latest alpine version alpine:latest instead of a specific version.
I was missing the echo step, with that I was able to install it:
echo "#testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
apk add --update --no-cache py3-scipy

Google cloud build running into "unsatisfiable constraints" error (image builds locally)

My Dckerfile
FROM python:3.7-alpine
ADD requirements.txt /code/requirements.txt
RUN apk --no-cache add --virtual build-dependencies \
build-base \
py-mysqldb \
gcc \
libc-dev \
libffi-dev \
mariadb-dev \
&& pip install -r /code/requirements.txt \
&& rm -rf .cache/pip \
&& apk del build-dependencies
RUN apk -q --no-cache add mariadb-client-libs
COPY . /code
...
I am able to build the image locally.
But when google (cloud build) tries to build the image I get the following error:
...
(28/28) Purging python2 (2.7.15-r0)
Executing busybox-1.28.4-r0.trigger
OK: 17 MiB in 34 packages
Removing intermediate container bc1fb0b1da92
---> bf2c564de5a5
Step 4/7 : RUN apk -q --no-cache add mariadb-client-libs
---> Running in 9c4fcad1f632
ERROR: unsatisfiable constraints:
**mariadb-client-libs (missing):**
required by: world[mariadb-client-libs]
The command '**/bin/sh -c apk -q --no-cache add mariadb-client-libs**' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1
A quick search online suggested that the repo could be offline, but I doubt that's the case. It seems Google Cloud build is blocking the access to the repo. Anyone else run into this issue? Any pointers on how to fix this?
On #helado's suggestion, I'm posting my comment from above as the answer:
#helado: I hesitated from posting this as the answer as its a solution that bypasses the problem. But i think the more important point is an issue like this should'nt stop folks from making progress :)
---- Copy pasted comment from above ----
It works for me when I try to build it locally, but fails on google
cloud. Also, its not the correct way to solve the problem, but I
switched my dependency form mariadb-client-libs to py-mysqldb and
all is working now. Just in case it helps you :)

What library contains cdefs.h on Alpine?

I am trying to compile some code on a Docker image running Alpine. However, gcc keeps terminating due to fatal error: sys/cdefs.h: No such file or directory. People on Google were saying to do
apt install libc6-dev-i386 gcc-multilib
Which I translated to apk add libc6-dev-i386 gcc-multilib. However, then I just get the error. ERROR: unsatisfiable constraints: for both of the libraries.
My Dockerfile is as follows:
FROM alpine
ADD . .
RUN apk update && apk add gcc make openssl libressl-dev musl-dev && make
ENTRYPOINT ./restrictions-crack "$hash" "$salt"
I ended up finding it, the library is bsd-compat-headers
You might use build-base - this is a meta-package that will install the GCC, libc-dev and binutils packages (amongst others).
Dockerfile:
FROM alpine
ADD . .
RUN apk update && apk add build-base && make
ENTRYPOINT ./restrictions-crack "$hash" "$salt"

Resources