This is my simple Dockerfile. The issue is SCALA_VERSION variable in the line wget -q --no-cookies ... does not get interpolated. I am not sure how to fix that. I appreciate any help or hint.
ARG SCALA_MAJOR_VERSION="2.13"
ARG SCALA_MINOR_VERSION="7"
ARG SCALA_VERSION="$SCALA_MAJOR_VERSION.$SCALA_MINOR_VERSION"
FROM openjdk:18-jdk-alpine AS base
LABEL version="$SCALA_VERSION"
WORKDIR /usr/lib
RUN apk add --no-cache bash \
&& apk add --no-cache --virtual=build-dependencies wget ca-certificates \
&& wget -q --no-cookies "https://downloads.lightbend.com/scala/${SCALA_VERSION}/scala-${SCALA_VERSION}.tgz" -O - | gunzip | tar x \
&& apk del build-dependencies \
&& rm -rf /tmp/*
Logs:
➜ compiler-toolchain git:(master) ✗ docker build . -t cool
Sending build context to Docker daemon 16.54MB
Step 1/18 : ARG SCALA_MAJOR_VERSION="2.13"
Step 2/18 : ARG SCALA_MINOR_VERSION="7"
Step 3/18 : ARG SCALA_VERSION="$SCALA_MAJOR_VERSION.$SCALA_MINOR_VERSION"
Step 4/18 : FROM openjdk:18-jdk-alpine AS base
---> c89120dcca4c
Step 5/18 : LABEL maintainer="boyland#uwm.edu"
---> Using cache
---> eb84f71065ca
Step 6/18 : LABEL version="$SCALA_VERSION"
---> Using cache
---> 23f11d22b6cb
Step 7/18 : WORKDIR /usr/lib
---> Using cache
---> 8762269e3700
Step 8/18 : RUN apk add --no-cache bash && apk add --no-cache --virtual=build-dependencies wget ca-certificates && wget -q --no-cookies "https://downloads.lightbend.com/scala/${SCALA_VERSION}/scala-${SCALA_VERSION}.tgz" -O - | gunzip | tar x && apk del build-dependencies && rm -rf /tmp/*
---> Running in 0cc02cf39a42
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/4) Installing ncurses-terminfo-base (6.3_p20211120-r0)
(2/4) Installing ncurses-libs (6.3_p20211120-r0)
(3/4) Installing readline (8.1.1-r0)
(4/4) Installing bash (5.1.8-r0)
Executing bash-5.1.8-r0.post-install
Executing busybox-1.34.1-r3.trigger
OK: 10 MiB in 24 packages
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/4) Installing libunistring (0.9.10-r1)
(2/4) Installing libidn2 (2.3.2-r0)
(3/4) Installing wget (1.21.2-r2)
(4/4) Installing build-dependencies (20211220.220536)
Executing busybox-1.34.1-r3.trigger
OK: 13 MiB in 28 packages
gunzip: invalid magic
tar: short read
The command '/bin/sh -c apk add --no-cache bash && apk add --no-cache --virtual=build-dependencies wget ca-certificates && wget -q --no-cookies "https://downloads.lightbend.com/scala/${SCALA_VERSION}/scala-${SCALA_VERSION}.tgz" -O - | gunzip | tar x && apk del build-dependencies && rm -rf /tmp/*' returned a non-zero code: 1
It's FROM openjdk:18-jdk-alpine AS base that does it. The ARGs set before you base on the new image aren't carried over. You need to move the ARG statements to after the FROM like this
FROM openjdk:18-jdk-alpine AS base
ARG SCALA_MAJOR_VERSION="2.13"
ARG SCALA_MINOR_VERSION="7"
ARG SCALA_VERSION="$SCALA_MAJOR_VERSION.$SCALA_MINOR_VERSION"
LABEL version="$SCALA_VERSION"
WORKDIR /usr/lib
RUN apk add --no-cache bash \
&& apk add --no-cache --virtual=build-dependencies wget ca-certificates \
&& wget -q --no-cookies "https://downloads.lightbend.com/scala/${SCALA_VERSION}/scala-${SCALA_VERSION}.tgz" -O - | gunzip | tar x \
&& apk del build-dependencies \
&& rm -rf /tmp/*
Related
My project has the following structure:
docker-compose.yml - docker-compose file I created
schemathesis - a folder with source code and dockerfile
Where docker-compose.yml is:
version: '3'
services:
schemathesis:
build: ./schemathesis
ports:
- "8180:80"
networks:
- default
Dockerfile in schemathesis folder looks like:
FROM python:3.10-alpine
LABEL Name=Schemathesis
WORKDIR /app
RUN addgroup --gid 1000 -S schemathesis && \
adduser --uid 1000 -D -S schemathesis -G schemathesis -s /sbin/nologin
COPY --chown=1000:1000 pyproject.toml README.rst src ./
RUN apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $HOME/.cargo/env && \
pip install --upgrade pip && pip install --no-cache-dir ./ && \
apk del .build-deps && \
rustup self uninstall -y
# Needed for the `.hypothesis` directory
RUN chown -R 1000:1000 /app
USER schemathesis
ENTRYPOINT ["schemathesis"]
When I run: sudo docker-compose up --build I am getting an error ERROR: Service 'schemathesis' failed to build:
Building schemathesis
Step 1/9 : FROM python:3.10-alpine
---> 8a3a8409a638
Step 2/9 : LABEL Name=Schemathesis
---> Using cache
---> f108325765ba
Step 3/9 : WORKDIR /app
---> Using cache
---> 9fc24fc24456
Step 4/9 : RUN addgroup --gid 1000 -S schemathesis && adduser --uid 1000 -D -S schemathesis -G schemathesis -s /sbin/nologin
---> Using cache
---> 64881e35ad07
Step 5/9 : COPY --chown=1000:1000 pyproject.toml README.rst src ./
---> Using cache
---> 8b9dfeb0ed09
Step 6/9 : RUN apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env && pip install --upgrade pip && pip install --no-cache-dir ./ && apk del .build-deps && rustup self uninstall -y
---> Running in fafc492c1f99
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/main: temporary error (try again later)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/community: temporary error (try again later)
ERROR: unable to select packages:
.build-deps-20230120.185651:
masked in: cache
satisfies: world[.build-deps=20230120.185651]
build-base (no such package):
required by: .build-deps-20230120.185651[build-base]
libffi-dev (no such package):
required by: .build-deps-20230120.185651[libffi-dev]
curl (no such package):
required by: .build-deps-20230120.185651[curl]
openssl-dev (no such package):
required by: .build-deps-20230120.185651[openssl-dev]
ERROR: Service 'schemathesis' failed to build: The command '/bin/sh -c apk add --no-cache --virtual=.build-deps build-base libffi-dev curl openssl-dev && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env && pip install --upgrade pip && pip install --no-cache-dir ./ && apk del .build-deps && rustup self uninstall -y' returned a non-zero code: 5
Any help would be greatly appreciated.
No idea what was the problem but the following set of command solve it:
sudo service firewalld stop
sudo service docker restart
sudo systemctl daemon-reload; systemctl restart docker
I am getting docker image build error "Operation not permitted". chmod 777 R /PredictionIO-0.14.0/lib/spark/ did not solve it.
I am trying to create PredictionIO docker image through git CICD to run in K8t
pio build --verbose
[INFO] DOCKER> [91mls: cannot access '/PredictionIO-0.14.0/lib/spark/pio-data-elasticsearch-assembly-0.14.0.jar': Operation not permitted ls: cannot access '/PredictionIO-0.14.0/lib/spark/pio-data-hbase-assembly-0.14.0.jar': Operation not permitted
[INFO] DOCKER> [91mls: cannot access '/PredictionIO-0.14.0/lib/spark/pio-data-hdfs-assembly-0.14.0.jar': Operation not permitted
ls: cannot access '/PredictionIO-0.14.0/lib/spark/pio-data-jdbc-assembly-0.14.0.jar': Operation not permitted
ls: cannot access '/PredictionIO-0.14.0/lib/spark/pio-data-localfs-assembly-0.14.0.jar': Operation not permitted
ls: cannot access '/PredictionIO-0.14.0/lib/spark/pio-data-s3-assembly-0.14.0.jar': Operation not permitted
[INFO] DOCKER> [91mError: Could not find or load main class org.apache.predictionio.tools.console.Console
[INFO] DOCKER> Removing intermediate container 8c164b439d1b
[ERROR] DOCKER> Unable to build image [myimage/bellmedia-pio-0.14.0:latest] : "The command '/bin/sh -c pio build --verbose' returned a non-zero code: 1" ["The command '/bin/sh -c pio build --verbose' returned a non-zero code: 1" ]
Dockerfile
FROM openjdk:8
MAINTAINER Jhon
ARG HTTP_PROXY=http://myproxyServer:8083/
ARG HTTPS_PROXY=http://myproxyServer:8083/
ENV DEBIAN_FRONTEND noninteractive
RUN export http_proxy=${HTTP_PROXY} \
&& export https_proxy=${HTTPS_PROXY} \
&& apt-get update && \
apt-get install -y net-tools curl patch gawk g++ gcc make libc6-dev vim telnet bash patch libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev libffi-dev krb5-user libpam-krb5 libpam-ccreds python3-pip tini libc6 libpam-modules libnss3 cron
ENV PIO_VERSION 0.14.0
ENV SPARK_VERSION 2.4.4
ENV ELK_VERSION 5.6.9
ENV SCALA_VERSION 2.11.12
ENV HBASE_VERSION 1.0.0
ENV HADOOP_VERSION 2.7
ENV PIO_GIT_URL http://archive.apache.org/dist/predictionio/
ENV PIO_HOME /PredictionIO-${PIO_VERSION}
ENV PATH=${PIO_HOME}/bin:/PredictionIO-0.14.0/vendors/spark-2.4.4-bin-hadoop2.7/bin:$PATH
ENV JAVA_HOME /usr/local/openjdk-8
EXPOSE 9200 9300
RUN export http_proxy=${HTTP_PROXY} \
&& export https_proxy=${HTTPS_PROXY} \
&& curl -O https://archive.apache.org/dist/predictionio/${PIO_VERSION}/apache-predictionio-${PIO_VERSION}.tar.gz
RUN mkdir predictionio
RUN tar -zxf apache-predictionio-${PIO_VERSION}.tar.gz -C /predictionio \
&& rm apache-predictionio-${PIO_VERSION}.tar.gz
COPY sbt-launch.jar /root/.sbt/launchers/1.2.3/
WORKDIR /predictionio
RUN export http_proxy=${HTTP_PROXY} \
&& export https_proxy=${HTTPS_PROXY} \
&& ./make-distribution.sh -Dscala.version=${SCALA_VERSION} -Dspark.version=${SPARK_VERSION} -Delasticsearch.version=${ELK_VERSION}
WORKDIR /
RUN tar -zxvf predictionio/PredictionIO-${PIO_VERSION}.tar.gz \
&& rm predictionio/PredictionIO-${PIO_VERSION}.tar.gz
COPY pio-env.sh ${PIO_HOME}/conf/
COPY log4j.properties ${PIO_HOME}/conf/
RUN mkdir ${PIO_HOME}/vendors
WORKDIR ${PIO_HOME}/vendors
RUN export http_proxy=${HTTP_PROXY} \
&& export https_proxy=${HTTPS_PROXY} \
&& curl -O https://archive.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz
RUN tar -zxvf spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz \
&& rm spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz
COPY spark-defaults.conf spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}/conf/
WORKDIR ${PIO_HOME}
RUN export http_proxy=${HTTP_PROXY} \
&& export https_proxy=${HTTPS_PROXY} \
&& mkdir URM \
&& cd URM \
&& git clone https://github.com/actionml/universal-recommender.git
COPY build.sbt /PredictionIO-0.14.0/URM/universal-recommender/
COPY engine.json /PredictionIO-0.14.0/URM/universal-recommender/
RUN rm -rf target
RUN ln -s /PredictionIO-0.14.0/vendors/spark-2.4.4-bin-hadoop2.7/ /opt/spark
WORKDIR ${PIO_HOME}/URM/universal-recommender/
RUN mkdir lib
COPY sbt-launch.jar /root/.sbt/launchers/0.13.13/
RUN export SBT_OPTS="-Dhttp.proxyHost=myproxy.ca -Dhttp.proxyPort=8083 -Dhttps.proxyHost=myproxy.ca -Dhttps.proxyPort=8083"
RUN chmod 777 -R /PredictionIO-0.14.0/lib/spark/
########################### Command below is failing ##################
RUN export http_proxy=${HTTP_PROXY} \
&& export https_proxy=${HTTPS_PROXY} \
&& pio build --verbose
CMD ["sh", "-c", "tail -f /dev/null"]
Any suggestion is highly applicated.
Thanks
Jhon
I want to install kafka rest proxy along with kafka in a docker single image. we are using kafka image as base image and want to install kafka-rest-proxy on the top of it. Below mentioned is our Docker-file
We have taken this as reference while creating this file https://github.com/confluentinc/kafka-rest-images/blob/master/kafka-rest/Dockerfile.deb8
FROM confluentinc/cp-kafka:5.5.0
ARG PROJECT_VERSION
ARG ARTIFACT_ID
ARG CONFLUENT_VERSION
ARG CONFLUENT_PACKAGES_REPO
ARG CONFLUENT_PLATFORM_LABEL
ARG CONFLUENT_DEB_VERSION
ARG ALLOW_UNSIGNED
LABEL io.confluent.docker.git.repo="confluentinc/kafka-rest-images"
ENV COMPONENT=kafka-rest
ENV KAFKA_REST_ZOOKEEPER_CONNECT=myzookeeper-zk:2181
ENV KAFKA_REST_HOST_NAME=test-kafka
# default listener
EXPOSE 8082
RUN echo "===> Installing ${COMPONENT}..." \
&& apt-get update \
&& echo "===> Adding confluent repository...https://packages.confluent.io/deb/5.5" \
&& if [ "x$ALLOW_UNSIGNED" = "xtrue" ]; then echo "APT::Get::AllowUnauthenticated \"true\";" > /etc/apt/apt.conf.d/allow_unauthenticated; else curl -s -L https://packages.confluent.io/deb/5.5/archive.key -o /tmp/archive.key && apt-key add /tmp/archive.key; fi \
&& echo "deb [arch=amd64] https://packages.confluent.io/deb/5.5 stable main" >> /etc/apt/sources.list \
&& sed -i 's;http://archive.debian.org/debian/;http://deb.debian.org/debian/;' /etc/apt/sources.list \
&& cat /etc/apt/sources.list \
&& apt-get install -y apt-transport-https \
&& apt-get install -y apt-utils \
&& apt-get update \
&& apt-get install -y confluent-${COMPONENT}=${CONFLUENT_VERSION}${CONFLUENT_PLATFORM_LABEL}-${CONFLUENT_DEB_VERSION} \
confluent-control-center=${CONFLUENT_VERSION}${CONFLUENT_PLATFORM_LABEL}-${CONFLUENT_DEB_VERSION} \
confluent-security=${CONFLUENT_VERSION}${CONFLUENT_PLATFORM_LABEL}-${CONFLUENT_DEB_VERSION} \
&& echo "===> clean up ..." \
&& apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \
&& echo "===> Setting up ${COMPONENT} dirs" \
&& chmod -R ag+w /etc/${COMPONENT}
COPY include/etc/confluent/docker /etc/confluent/docker
CMD ["/etc/confluent/docker/run"]
Image got successfully built
docker build . -t my-kafka-rest-custom:3.3.3
Sending build context to Docker daemon 358.4kB
Step 1/21 : FROM confluentinc/cp-kafka:5.0.1
---> 5467234daea9
Step 2/21 : ARG PROJECT_VERSION
---> Using cache
---> bf90e3020232
Step 3/21 : ARG ARTIFACT_ID
---> Using cache
---> 3306ca86672a
Step 4/21 : ARG CONFLUENT_VERSION
---> Using cache
---> 09f037fa5954
Step 5/21 : ARG CONFLUENT_PACKAGES_REPO
---> Using cache
---> 6760a594ee94
Step 6/21 : ARG CONFLUENT_PLATFORM_LABEL
---> Using cache
---> d1321ff49c72
Step 7/21 : ARG CONFLUENT_DEB_VERSION
---> Using cache
---> 2cdb2b914f65
Step 8/21 : ARG ALLOW_UNSIGNED
---> Using cache
---> 8ba2b344ed5e
Step 9/21 : LABEL io.confluent.docker.git.repo="confluentinc/kafka-rest-images"
---> Using cache
---> a07481842889
Step 10/21 : ENV COMPONENT=kafka-rest
---> Using cache
---> 3ac4051385f1
.
.
.
.
.
.
Step 15/21 : ENV KAFKA_REST_ZOOKEEPER_CONNECT=myzookeeper-zk
---> Using cache
---> 470e38dda0d1
Step 16/21 : ENV KAFKA_REST_HOST_NAME=test-kafka
---> Using cache
---> faf0fc54ded6
Step 17/21 : EXPOSE 8082
---> Using cache
---> bd28c9c8e539
Step 18/21 : RUN echo "===> Installing ${COMPONENT}..." && apt-get update && echo "===> Adding confluent repository...https://packages.confluent.io/deb/5.5" && if [ "x$ALLOW_UNSIGNED" = "xtrue" ]; then echo "APT::Get::AllowUnauthenticated \"true\";" > /etc/apt/apt.conf.d/allow_unauthenticated; else curl -s -L https://packages.confluent.io/deb/5.5/archive.key -o /tmp/archive.key && apt-key add /tmp/archive.key; fi && echo "deb [arch=amd64] https://packages.confluent.io/deb/5.5 stable main" >> /etc/apt/sources.list && sed -i 's;http://archive.debian.org/debian/;http://deb.debian.org/debian/;' /etc/apt/sources.list && cat /etc/apt/sources.list && apt-get install -y apt-transport-https && apt-get install -y apt-utils && apt-get update && apt-get install -y confluent-${COMPONENT}=${CONFLUENT_VERSION}${CONFLUENT_PLATFORM_LABEL}-${CONFLUENT_DEB_VERSION} confluent-control-center=${CONFLUENT_VERSION}${CONFLUENT_PLATFORM_LABEL}-${CONFLUENT_DEB_VERSION} confluent-security=${CONFLUENT_VERSION}${CONFLUENT_PLATFORM_LABEL}-${CONFLUENT_DEB_VERSION} && echo "===> clean up ..." && apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* && echo "===> Setting up ${COMPONENT} dirs" && chmod -R ag+w /etc/${COMPONENT}
---> Using cache
---> 4d311cc7cf93
Step 19/21 : COPY include/etc/confluent/docker /etc/confluent/docker
---> Using cache
---> 579bd961c0d8
.
.
Step 21/21 : CMD ["/etc/confluent/docker/run"]
---> Running in 4e7051ffde90
Removing intermediate container 4e7051ffde90
---> 61376569c763
Successfully built 61376569c763
Successfully tagged my-kafka-rest-custom:3.3.3
When I am trying to install it using helm charts on Openshift , Image is successfully pulled and container got created but it is getting restarted again and again and after sometime it is crashing. While checking logs we encounter with following errors in logs
main-SendThread(myzookeeper-zk:2181)] INFO org.apache.zookeeper.ClientCnxn - Socket connection established, initiating session, client: /10.130.27.9:45270, server: myzookeeper-zk/10.128.105.218:2181
[main-SendThread(myzookeeper-zk:2181)] INFO org.apache.zookeeper.ClientCnxn - Session establishment complete on server myzookeeper-zk/10.128.105.218:2181, sessionid = 0x20039cfaa970059, negotiated timeout = 40000
[main] INFO org.apache.zookeeper.ZooKeeper - Session: 0x20039cfaa970059 closed
[main] ERROR io.confluent.admin.utils.cli.KafkaReadyCommand - Error while running kafka-ready.
[main-EventThread] INFO org.apache.zookeeper.ClientCnxn - EventThread shut down for session: 0x20039cfaa970059
org.apache.kafka.common.errors.TimeoutException: Timed out waiting for Kafka to register brokers in Zookeeper. timeout (ms) = 40000
By overwriting the component variable, the broker will no longer start.
The rest proxy needs a broker
Hi I got a project with a dockerfile, and I am trying to build the dockerfile to run the project in the environment it was created but I seem to get an error at step 5 of the build and when I look at the dockerfile I find the code a bit strange/I dont understand it at that point.
This is the dockerfile:
FROM node:8.10-alpine
ENV NODE_ENV development
# Create app directory
WORKDIR /var/app
# Install Node packages
COPY package.json package.json
RUN apk install git \
&& npm i \
&& apk del .gyp\
&& mv /var/app/node_modules /node_modules \
&& rm -rf /var/cache/apk/* \
&& apk del git
# Bundle app source
COPY . .
#COPY entrypoint.sh entrypoint.sh
# Expose port
EXPOSE 88
#ENTRYPOINT ["./entrypoint.sh"]
CMD ["npm", "run", "dev"]
This is the error i am getting:
Step 5/8 : RUN apk install git && npm i && apk del .gyp && mv /var/app/node_modules /node_modules && rm -rf /var/cache/apk/* && apk del git
---> Running in 251259cdb8a2
apk-tools 2.7.5, compiled for x86_64.
Then I get a bunch of text which resembles what you get if you type -help on something and then at the end i get:
This apk has coffee making abilities.
The command '/bin/sh -c apk install git && npm i && apk del .gyp && mv /var/app/node_modules /node_modules && rm -rf /var/cache/apk/* && apk del git' returned a non-zero code: 1
This seems to be the problematic part:
RUN apk install git \
&& npm i \
&& apk del .gyp\
&& mv /var/app/node_modules /node_modules \
&& rm -rf /var/cache/apk/* \
&& apk del git
Just try adding an additional line before using apk and see if it fixes
RUN echo "ipv6" >> /etc/modules
RUN apk install git \
Reference: link
Note: Breaking the problematic step into multiple steps like
RUN apk install git
RUN npm i
RUN apk del .gyp
RUN mv /var/app/node_modules /node_modules
RUN rm -rf /var/cache/apk/*
RUN apk del git
will help to locate the point of problem more accurately.
You have 2 issues. One is with the command apk del .gyp (which return code is different from 0) , and the other is related to the fact that you do not mount correctly your folder.
# apk del .gyp
# echo $?
1
Besides, there is no such thing as /var/app/node_modules mounted in the container:
# ls /var/app/node_modules
# ls: /var/app/node_modules: No such file or directory
What you would do, is
Make sure you mount correctly /var/app/node_modules in the container
I am not sure what the command apk del .gyp is doing, but you may need to investigate it. It does not seems to work properly.
I've written this straightforward Dockerfile:
FROM alpine
WORKDIR /usr/src
RUN apk add --no-cache curl jq
RUN mkdir /env
COPY src/* /usr/src/
RUN chmod u+x /usr/src/*.sh
CMD /usr/src/wsec.sh
When I try to build the image, I'm getting this error message:
Sending build context to Docker daemon 43.52kB
Step 1 : FROM alpine
---> 3fd9065eaf02
Step 2 : WORKDIR /usr/src
---> Using cache
---> 4c7b79dc4239
Step 3 : RUN apk add --no-cache curl jq
---> Running in 0cf83217477a
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
curl (missing):
required by: world[curl]
jq (missing):
required by: world[jq]
The command '/bin/sh -c apk add --no-cache curl jq' returned a non-zero code: 2
It could happen that main alpine repository http://dl-cdn.alpinelinux.org/alpine is temporary unavailable. Just like in your case. In order to be not blocked on this issue, we should add other alpine repositories to our alpine image:
http://dl-2.alpinelinux.org
http://dl-3.alpinelinux.org
http://dl-4.alpinelinux.org
http://dl-5.alpinelinux.org
So, the final Dockerfile is:
FROM alpine
WORKDIR /usr/src
RUN echo "http://dl-2.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-2.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "http://dl-3.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-3.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories && \
echo "http://dl-5.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-5.alpinelinux.org/alpine/v3.7/community" >> /etc/apk/repositories
RUN apk add --no-cache curl jq
RUN mkdir /env
COPY src/* /usr/src/
RUN chmod u+x /usr/src/*.sh
CMD /usr/src/wsec.sh