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

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 :)

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

Docker alpine apk cannot find git-lfs package

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.

Unable to use make in alpine image

I cant get make to work in alpine
make update_tools works when I run it on my OSX, but when i run it in the alpine image i get the following error:
make: *** No rule to make target 'update_tools'. Stop.
Here is what my Dockerfile looks like now:
#Download base image Alpine-3.9 Golang 1.12
FROM golang:1.12-alpine3.9
# Set Working Directory is /usr/app
WORKDIR /usr/app
# Install Alpine Dependencies
RUN apk update && apk upgrade && apk add --update alpine-sdk && \
apk add --no-cache bash git openssh make cmake
COPY cosmos-sdk .
WORKDIR /usr/app/cosmos-sdk
RUN git checkout v0.33.0 && \
make update_tools && \
make vendor-deps && \
make install && \
gaiad init $(whoami) && \
rm .gaiad/config/genesis.json && \
curl https://raw.githubusercontent.com/cosmos/launch/master/genesis.json > $HOME/.gaiad/config/genesis.json
#Add persistent peer to config.toml file
RUN sed -i '' 's/persistent_peers = ""/persistent_peers = "89e4b72625c0a13d6f62e3cd9d40bfc444cbfa77#34.65.6.52:26656"/' $HOME/.gaiad/config/config.toml
#Start gaid daemon and set logging to info
CMD ["gaiad start --log_level="*:info""]
# Expose the ports
EXPOSE 26656 26657
Makefile: https://github.com/cosmos/cosmos-sdk/blob/develop/Makefile
I would appreciate any pointers on this
Am having this issue.
It seems something from the golang-alpine image itself.
** --- Solution --- **
just install the make in your image as following:
apk add --no-cache make
Direct clone and checkout v0.33.0 doesn't have mentioned problem. It looks like a problem with git checkout v0.33.0 command. Probably you have uncommitted changes. Please check/provide docker build output.
had a similar issue, make sure your Makefile is added to the docker image, mine Makefile was added to .dockerignore file, so it was not present in docker image and I got a similar error message

Docker + older version of Elixir/Phoenix

I have been requested to move an Elixir/Phoenix app to Docker, with which I have no prior experience. The app uses non-latest versions of Elixir and Phoenix so I have had to diverge from the code online which generally focuses on latest versions. That led me to write this Dockerfile
# FROM bitwalker/alpine-elixir:latest
FROM bitwalker/alpine-elixir:1.3.4
MAINTAINER Paul Schoenfelder <paulschoenfelder#gmail.com>
# Important! Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT=2017-07-26 \
# Set this so that CTRL+G works properly
TERM=xterm
# Install NPM
RUN \
mkdir -p /opt/app && \
chmod -R 777 /opt/app && \
apk update && \
apk --no-cache --update add \
git make g++ wget curl inotify-tools \
nodejs nodejs-current-npm && \
npm install npm -g --no-progress && \
update-ca-certificates --fresh && \
rm -rf /var/cache/apk/*
# Add local node module binaries to PATH
ENV PATH=./node_modules/.bin:$PATH \
HOME=/opt/app
# Install Hex+Rebar
RUN mix local.hex --force && \
mix local.rebar --force
WORKDIR /opt/app
CMD ["/bin/sh"]
<then it goes on to add some elixir depedencies>
On running
sudo docker build -t phoenix .
I'm ending up with this error and wondering how to get around it? Noting 'current' in the title I'm wondering whether using an older version of nodejs, and if so, how to do that? Beyond that I am open to any and all suggestions
ERROR: unsatisfiable constraints:
nodejs-current-npm (missing):
required by: world[nodejs-current-npm]
musl-1.1.14-r14:
breaks: musl-dev-1.1.14-r15[musl=1.1.14-r15]
That looks like bitwalker/alpine-elixir issue 5:
when using tagged images, you may sometimes need to explicitly upgrade packages, as the installed packages are at the versions found when building the image.
Generally it's as simple as adding apk --update upgrade before any commands which install packages.
Indeed, when you compare the old elixir 1.4.4-based Dockerfile, and the latest one, you will see an upgrade first in the latter:
apk --no-cache --update upgrade && \
apk add --no-cache --update --virtual .elixir-build \
...
Try and add that to your Dockerfile.

Resources