How to install libvips on Alpine 3.8? - linux

I try to install vips-dev package to alpine linux 3.8. But get following error:
docker run -it --rm alpine:3.8 /bin/sh -c "apk add --update --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing vips-dev"
fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
pc:fftw3 (missing):
required by: vips-dev-8.7.4-r1[pc:fftw3] vips-dev-8.7.4-r1[pc:fftw3] vips-dev-8.7.4-r1[pc:fftw3]
How to solve it?

This is a known packaging issue of vips-dev on edge/testing:
https://bugs.alpinelinux.org/issues/9561
As a workaround, make sure to add both edge/main and edge/testing repositories to your apk command:
sudo docker run -it --rm alpine:3.8 /bin/sh -c "apk add --update --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing --repository http://dl-3.alpinelinux.org/alpine/edge/main vips-dev"
Update, 30/5/19:
vips-dev has moved from the edge/testing branch to edge/community, and updated to version 8.8.0-r0. Therefore, the updated command line is:
sudo docker run -it --rm alpine:3.8 /bin/sh -c "apk add --update --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community --repository http://dl-3.alpinelinux.org/alpine/edge/main vips-dev"

Related

How to create a Docker image for Oraclelinux 8 arm64v8

So Currently I have a Dockerfile to create "oraclelinux-8-x86" image, but I want to edit this Dockefile to create "Oraclelinux-8-arm64v8" Image instead.
This is how my current Dockerfile looks like-
FROM oraclelinux:8
# Setup basic environment stuff
ENV container docker
ENV LANG en_US.UTF-8
ENV TZ EST
# Base image stuff
#RUN yum install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel vim yum-utils sssd sssd-tools krb5-libs krb5-workstation.x86_64
# CCSMP dependent
RUN yum install -y glibc-devel.i686 krb5-devel
RUN yum install -y wget
RUN yum install -y make gcc java-1.8.0-openjdk-devel tar perl maven svn
# Minor changes to image to get ccsmp to build
RUN ln -s /usr/lib/jvm/java-1.8.0-openjdk /usr/lib/jvm/default-jvm
RUN cp /usr/include/linux/stddef.h /usr/include/stddef.h
RUN wget https://mirror.its.dal.ca/apache//ant/binaries/apache-ant-1.10.12-bin.zip
RUN unzip apache-ant-1.10.12-bin.zip && mv apache-ant-1.10.12/ /opt/ant
ENV JAVA_HOME /usr
ENV ANT_HOME="/usr/bin/ant"
ENV PATH="/usr/bin/ant:$PATH"
CMD /bin/bash
Is there any way to do this? Any suggestions are highly appreciated.
The easiest way to achieve this is to use docker buildx for your builder. Buildx has a flag called --platform with which you can tell the builder what architecture you are building for. More of this of the official docker page.
Example:
docker buildx build -t adamparco/helloworld:latest --platform linux/arm64 --push github.com/adamparco/helloworld
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t adamparco/demo:latest --push .

Unable to run aliyun-cli in Docker:stable container after installing it. Errors as command not found

I am unsure if stack overflow or system fault is the right stack exchange site but I'm going with stack overflow cause the alicloud site posted to add a tag and ask a question here.
So. I'm currently building an image based on Docker:stable, that is an alpine distro, that will have aliyun-cli installed and available for use. However I am getting a weird error of Command Not Found when I'm running it. I have followed the guide here https://partners-intl.aliyun.com/help/doc-detail/139508.htm and moved the aliyun binary to /usr/sbin
Here is my Dockerfile for example
FROM docker:stable
RUN apk update && apk add curl
#Install python 3
RUN apk update && apk add python3 py3-pip
#Install AWS Cli
RUN pip3 install awscli --upgrade
# Install Aliyun CLI
RUN curl -L -o aliyun-cli.tgz https://aliyuncli.alicdn.com/aliyun-cli-linux-3.0.30-amd64.tgz
RUN tar -xzvf aliyun-cli.tgz
RUN mv aliyun /usr/bin
RUN chmod +x /usr/bin/aliyun
RUN rm aliyun-cli.tgz
However when i'm running aliyun (which can be auto-completed) I am getting this
/ # aliyun
sh: aliyun: not found
I've tried moving it to other bins. Cding into the folder and calling it explicitly but still always getting a command not found. Any suggestions would be welcome.
Did you check this Dockerfile?
Also why you need to install aws-cli in the same image and why you will need to maintain it for your self when AWS provide managed aws-cli image.
docker run --rm -it amazon/aws-cli --version
that's it for aws-cli image,but if you want in existing image then you can try
RUN pip install awscli --upgrade
DockerFile
FROM python:2-alpine3.8
LABEL com.frapsoft.maintainer="Maik Ellerbrock" \
com.frapsoft.version="0.1.0"
ARG SERVICE_USER
ENV SERVICE_USER ${SERVICE_USER:-aliyun}
RUN apk add --no-cache curl
RUN curl https://raw.githubusercontent.com/ellerbrock/docker-collection/master/dockerfiles/alpine-aliyuncli/requirements.txt > /tmp/requirements.txt
RUN \
adduser -s /sbin/nologin -u 1000 -H -D ${SERVICE_USER} && \
apk add --no-cache build-base && \
pip install aliyuncli && \
pip install --no-cache-dir -r /tmp/requirements.txt && \
apk del build-base && \
rm -rf /tmp/*
USER ${SERVICE_USER}
WORKDIR /usr/local/bin
ENTRYPOINT [ "aliyuncli" ]
CMD [ "--help" ]
build and run
docker build -t aliyuncli .
docker run -it --rm aliyuncli
output
docker run -it --rm abc aliyuncli
usage: aliyuncli <command> <operation> [options and parameters]
<aliyuncli> the valid command as follows:
batchcompute | bsn
bss | cms
crm | drds
ecs | ess
ft | ocs
oms | ossadmin
ram | rds
risk | slb
ubsms | yundun
After a lot of lookup I found a github issue in the official aliyun-cli that sort of describes that it is not compatible with alpine linux because of it's not muslc compatible.
Link here: https://github.com/aliyun/aliyun-cli/issues/54
Following the workarounds there I build a multi-stage docker file with the following that simply fixed my issue.
Dockerfile
#Build aliyun-cli binary ourselves because of issue
#in alpine https://github.com/aliyun/aliyun-cli/issues/54
FROM golang:1.13-alpine3.11 as cli_builder
RUN apk update && apk add curl git make
RUN mkdir /srv/aliyun
WORKDIR /srv/aliyun
RUN git clone https://github.com/aliyun/aliyun-cli.git
RUN git clone https://github.com/aliyun/aliyun-openapi-meta.git
ENV GOPROXY=https://goproxy.cn
WORKDIR aliyun-cli
RUN make deps; \
make testdeps; \
make build;
FROM docker:19
#Install python 3 & jq
RUN apk update && apk add python3 py3-pip python3-dev jq
#Install AWS Cli
RUN pip3 install awscli --upgrade
# Install Aliyun CLI from builder
COPY --from=cli_builder /srv/aliyun/aliyun-cli/out/aliyun /usr/bin
RUN aliyun configure set --profile default --mode EcsRamRole --ram-role-name build --region cn-shanghai

How to check if libpcap installed in Alphine docker container

I installed libpcap in my container using below docker file using docker file below. How do I make sure it was installed and working as expected?
I tried below with the hope to see libpcap
D:\work >docker exec -u 0 -it containerId sh
/app # cd /etc/apk
/etc/apk # cat repositories
http://dl-cdn.alpinelinux.org/alpine/v3.8/main
http://dl-cdn.alpinelinux.org/alpine/v3.8/community
/etc/apk #
Below is my docker file
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine AS build
# Install packages
RUN apk update
RUN apk -U --no-cache add libpcap
Running the apk info command has below output
WARNING: Ignoring APKINDEX.adfa7ceb.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.efaa1f73.tar.gz: No such file or directory
musl
busybox
alpine-baselayout
alpine-keys
libressl2.7-libcrypto
libressl2.7-libssl
libressl2.7-libtls
ssl_client
zlib
apk-tools
scanelf
musl-utils
libc-utils
ca-certificates
krb5-conf
libcom_err
keyutils-libs
libverto
krb5-libs
libgcc
libintl
libcrypto1.0
libssl1.0
libstdc++
userspace-rcu
lttng-ust
tzdata
Run docker exec command and try this
$ apk info
This will list all the installed packages in alpine.
I can see libcap in the output.
If you still can't see the package. Make sure you have run apk update before installing libcap

Install packages in Alpine docker

How do I write Dockerfile commands to install the following in alpine docker image:
software-properties-common
openjdk-8-jdk
python3
nltk
Flask
The equivalent of apt or apt-get in Alpine is apk
A typical Dockerfile will contain, for example:
RUN apk add --no-cache wget
--no-cache is the equivalent to:
apk add wget && rm -rf /var/cache/apk/*
or, before the --no-cache option was available:
RUN apk update && apk add wget
Alpine rm -rf /var/cache/apk/* has the Debian equivalent rm -rf /var/lib/apt/lists/*.
See the Alpine comparison with other distros for more details.

Docker Alpine linux package masked

I am trying to install a package on my docker image that runs alpine but I get the following error,
Removing intermediate container 54bbe0932899
Step 14 : RUN apk add openblas openblas-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
---> Running in 24d7a8c00c89
fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
openblas-0.2.19-r0:
masked in: #community
satisfies: world[openblas]
openblas-dev-0.2.19-r0[openblas=0.2.19-r0]
openblas-ilp64-0.2.19-r0:
masked in: #community
satisfies:
openblas-dev-0.2.19-r0[openblas-ilp64=0.2.19-r0]
openblas-dev-0.2.19-r0:
masked in: #community
satisfies: world[openblas-dev]
ERROR: Service 'web' failed to build: The command '/bin/sh -c apk add openblas openblas-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted' returned a non-zero code: 3
Important part of the Dockerfile:
FROM python:3.5.2-alpine
ADD repositories /etc/apk/repositories
RUN apk upgrade --update
RUN apk add --update libstdc++ curl ca-certificates bash
RUN apk add openblas openblas-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
RUN apk add --update py-scipy py-numpy py-numpy-dev
The repository file is
http://dl-cdn.alpinelinux.org/alpine/v3.4/main
#testing http://dl-cdn.alpinelinux.org/alpine/edge/testing
#community http://dl-cdn.alpinelinux.org/alpine/edge/community
How I can force the installation of openblas?
I am new to alpine so apologies if this is a straight forward question.
I found the solution,
the following line:
RUN apk add openblas openblas-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
should be
RUN apk add openblas#community openblas-dev#community --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted
Now docker continues to the next stage.

Resources