I'm trying to install nodeJs, npm and newman in my docker image, so I have this in the docker file :
FROM python:3.6.1-alpine
RUN apk update && \
apk add --no-cache nodejs-npm && \
apk add --update nodejs && \
npm install newman --global
That gives me this error:
ERROR: unsatisfiable constraints:
nodejs-npm (missing):
required by: world[nodejs-npm]
I got the command from this question: How to install npm in alpine linux
How can I fix this?
Docker image python:3.6.1-alpine is based on Alpine Linux v3.4.
According to alpine packages portal, npm binary can be found in nodejs package in Alpine Linux version 3.4.
So, the final Dockerfile is:
FROM python:3.6.1-alpine
RUN apk update && \
apk add --update nodejs && \
npm install newman --global
Related
I'm deploying NuxtJs project to live server but getting error
E: Unable to locate package tini
{"code":100,"message":"The command '/bin/sh -c apt-get update && apt-get install -y tini' returned a non-zero code: 100"}
The command '/bin/sh -c apt-get update && apt-get install -y tini' returned a non-zero code: 100
Build has failed!
Dockerfile:
FROM node:14.15.1
RUN apt-get update && apt-get install -y
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=TRUE
RUN apk add --no-cache su-exec
# create destination directory
RUN mkdir -p /usr/src/nuxt-app
WORKDIR /usr/src/nuxt-app
# update and install dependency
RUN apk update && apk upgrade
RUN apk add git
# copy the app, note .dockerignore
COPY . /usr/src/nuxt-app/
RUN npm install
RUN npm run build
EXPOSE 3000
ENV NUXT_HOST=127.0.0.1
ENV NUXT_PORT=3000
CMD \[ "npm", "start" \]
# Set any ENVs
ARG BASE_URL=${BASE_URL}
ARG BASE_URL_WITHOUT_API=${BASE_URL_WITHOUT_API}
ARG NUXT_ENV_BASE_URL=${NUXT_ENV_BASE_URL}
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
I am trying to pip install python-ldap in Docker but am missing lber.h. I need python-ldap because I am trying to implement an OS agnostic SSO for my application, following this for now and hoping it doesn't break the rest of my app https://code.tutsplus.com/tutorials/flask-authentication-with-ldap--cms-23101
I have tried
RUN apk add libsasl2-dev libldap2-dev libssl-dev
and
RUN apk --no-cache add libsasl2-dev libldap2-dev libssl-dev
but I get the following error:
ERROR: unsatisfiable constraints:
libldap2-dev (missing):
required by: world[libldap2-dev]
libsasl2-dev (missing):
required by: world[libsasl2-dev]
libssl-dev (missing):
required by: world[libssl-dev]
Having gone to https://pkgs.alpinelinux.org/packages?name=libldap2-dev&branch=edge I feel that it is possible that these packages do indeed not exist within the alpine python image. Therefore, I tried substituting the installations with packages that exist in the above link, namely: openssl libsasl libldap
This didn't work either and had the same effect as not installing any of the packages i.e. the header missing error appeared:
Modules/constants.h:7:10: fatal error: lber.h: No such file or directory
#include "lber.h"
^~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
as a result of /tmp/pip-install-doifa8k9/python-ldap/
My Dockerfile:
FROM python:3.8.0-alpine
WORKDIR /home/flask
ADD . /home/flask
RUN apk --no-cache add --update --virtual .build-editdistance gcc g++ && \
apk --no-cache add libsasl libldap openssl && \
apk --no-cache add --update --virtual .libs libstdc++ && \
apk add linux-headers && \
apk add unixodbc-dev;
RUN rm -rf /var/cache/apk/* && \
pip install --upgrade pip && \
pip install --upgrade setuptools && \
pip install --no-cache-dir -Ur requirements.txt && \
apk del .build-editdistance;
EXPOSE 5000
For alpine python in docker:
apk add openldap-dev
instead of
apk add libsasl libldap openssl
This is answered in I can't install python-ldap but the answer is buried sufficiently deep and obfuscated by the accepted answer ( which is where libsasl libldap openssl came from) that it would be a good idea to keep this docker specific question
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.
I have the following Dockerfile
FROM debian:jessie
MAINTAINER Ewan Valentine <ewan#theladbible.com>
WORKDIR /tmp
RUN apt-get update -y && \
apt-get install -y \
curl
RUN curl --silent --location https://deb.nodesource.com/setup_0.12 | bash -
RUN apt-get install --yes nodejs
VOLUME ["/var/www/admin/src"]
RUN mkdir -p /var/www/admin/src
WORKDIR /var/www/admin/src
RUN npm install -g gulp
ENTRYPOINT ["gulp"]
However, when I run $ docker-compose run gulp I get the following error:
[10:47:49] Local gulp not found in /var/www/admin/src
[10:47:49] Try running: npm install gulp
I'm using docker-compose and this container is linked to a volume where the source code is kept, which all runs fine otherwise.
I was liking to the wrong volume! Sorted now.