Thanks everyone for your help. I got it working with below Dockerfile and run.sh copied from git repo of apache-ignite ARG OPTION_LIBS and CONFIG_URI are set in kubernetes stateful-set.yaml file where this image is used as container
FROM adoptopenjdk/openjdk11 # Settings ARG IGNITE_CFG_XML="node-configuration.xml" ARG IGNITE_VERSION="2.11.0" #ARG OPTION_LIBS="ignite-kubernetes,ignite-rest-http" ENV IGNITE_HOME /opt/ignite/apache-ignite #ENV CONFIG_URI config/$IGNITE_CFG_XML # Disabling quiet mode. ENV IGNITE_QUIET=false WORKDIR /opt/ignite # Add missing software RUN apt-get update &&\ apt-get install bash && \ apt-get install -y wget && \ apt-get install unzip && \ wget https://dlcdn.apache.org//ignite/${IGNITE_VERSION}/apache-ignite-${IGNITE_VERSION}-bin.zip && \ unzip -o apache-ignite-${IGNITE_VERSION}-bin.zip && \ mv apache-ignite-${IGNITE_VERSION}-bin apache-ignite && \ rm apache-ignite-${IGNITE_VERSION}-bin.zip # Copy main binary archive #COPY apache-ignite* apache-ignite # Copy sh files and set permission COPY run.sh $IGNITE_HOME/ COPY ./$IGNITE_CFG_XML $IGNITE_HOME/config # Grant permission to copy optional libs RUN chmod 777 ${IGNITE_HOME}/libs # Grant permission to create work directory RUN chmod 777 ${IGNITE_HOME} # Grant permission to execute entry point RUN chmod 555 $IGNITE_HOME/run.sh # Entry point RUN export JAVA_HOME="$(dirname $(dirname $(readlink -f $(which java))))" CMD $IGNITE_HOME/run.sh # Container port exposure EXPOSE 11211 47100 47500 49112 10800 8080 On Thu, Nov 18, 2021 at 6:04 PM Surinder Mehra <redni...@gmail.com> wrote: > Thanks Maksim for reply. Actually I ddint need to set it. When this image > is used in statefulset.yaml, we are setting config_uri and other jvm_opts > there. Issue is ignite still using jdk 8 although when I login to container > and print java version, it prints 11. This is another simpler way to create > docker image with java 11. This has the same behavior. It also uses jdk 8 > instead of 11. Any idea which ARG I am missing ? > > FROM apacheignite/ignite > > # Install OpenJDK-11 > RUN apk --no-cache add openjdk11 > --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community > RUN export JAVA_HOME="$(dirname $(dirname $(readlink -f $(which java))))" > > > Container logs : > [12:23:38] OS: Linux 4.14.243-185.433.amzn2.x86_64 amd64 > [12:23:38] VM information: OpenJDK Runtime Environment 1.8.0_212-b04 > IcedTea OpenJDK 64-Bit Server VM 25.212-b04 > [12:23:38] Please set system property '-Djava.net.preferIPv4Stack=true' to > avoid possible problems in mixed environments. > [12:23:38] Initial heap size is 32MB (should be no less than 512MB, use > -Xms512m -Xmx512m). > [12:23:38] Configured plugins: > [12:23:38] ^-- None > > > Java version cmd in conatiner : > > bash-4.4# java -version > openjdk version "11.0.13" 2021-10-19 > OpenJDK Runtime Environment (build 11.0.13+8-alpine-r0) > OpenJDK 64-Bit Server VM (build 11.0.13+8-alpine-r0, mixed mode) > bash-4.4# > > Default JVM : > > bash-4.4# cd /usr/lib/jvm > bash-4.4# ls -l > total 0 > lrwxrwxrwx 1 root root 15 Nov 18 09:01 default-jvm -> > java-11-openjdk > drwxr-xr-x 5 root root 39 May 11 2019 java-1.8-openjdk > drwxr-xr-x 10 root root 185 Nov 18 09:01 java-11-openjdk > bash-4.4# > > Regards, > > On Thu, Nov 18, 2021 at 2:00 PM Maksim Timonin <timonin.ma...@gmail.com> > wrote: > >> Hi, you should move ignite-kubernetes (and others optional libs you're >> going to use) from optional to $IGNITE_HOME/libs/ >> >> On Wed, Nov 17, 2021 at 6:50 PM Surinder Mehra <redni...@gmail.com> >> wrote: >> >>> Thanks for the suggestion. I tried to fix dependencies and it works with >>> default-ignite-config.xml, which means when CONFIG_URI ARG is not provided. >>> When I pass my custom node configuration file which contains KubernetesIP >>> finder, the container fails to find the K8 Ip finder class. >>> I have verified that the container /libs/optional/ directory has >>> ignite-kuberenetes and zookeper jars in it. >>> So is it genuine error or if I deploy this in kubernetes as stateful set >>> after using this image, it would work >>> >>> Here is my updated Dockerfile >>> >>> FROM adoptopenjdk/openjdk11 >>> >>> # Settings >>> ARG IGNITE_CFG_XML="node-configuration.xml" >>> ARG IGNITE_VERSION="2.11.0" >>> ENV IGNITE_HOME /opt/ignite/apache-ignite >>> ENV CONFIG_URI config/$IGNITE_CFG_XML >>> # Disabling quiet mode. >>> ENV IGNITE_QUIET=false >>> WORKDIR /opt/ignite >>> >>> # Add missing software >>> RUN apt-get update &&\ >>> apt-get install bash && \ >>> apt-get install -y wget && \ >>> apt-get install unzip && \ >>> wget >>> https://dlcdn.apache.org//ignite/${IGNITE_VERSION}/apache-ignite-${IGNITE_VERSION}-bin.zip >>> && \ >>> unzip -o apache-ignite-${IGNITE_VERSION}-bin.zip && \ >>> mv apache-ignite-${IGNITE_VERSION}-bin apache-ignite && \ >>> rm apache-ignite-${IGNITE_VERSION}-bin.zip >>> # Copy main binary archive >>> #COPY apache-ignite* apache-ignite >>> >>> # Copy sh files and set permission >>> COPY run.sh $IGNITE_HOME/ >>> COPY ./$IGNITE_CFG_XML $IGNITE_HOME/config >>> # Grant permission to copy optional libs >>> RUN chmod 777 ${IGNITE_HOME}/libs >>> >>> # Grant permission to create work directory >>> RUN chmod 777 ${IGNITE_HOME} >>> >>> # Grant permission to execute entry point >>> RUN chmod 555 $IGNITE_HOME/run.sh >>> >>> # Entry point >>> CMD $IGNITE_HOME/run.sh >>> >>> # Container port exposure >>> EXPOSE 11211 47100 47500 49112 10800 8080 >>> >>> >>> On Wed, Nov 17, 2021 at 5:49 PM Surinder Mehra <redni...@gmail.com> >>> wrote: >>> >>>> Yes, thanks for replying. I tried doing that but it assumes the ignite >>>> binary is present in the local directory somewhere. " COPY >>>> apache-ignite* apache-ignite " >>>> Could you please explain >>>> 1. where is it reading ignite binaries from and >>>> 2. ignite binaries zip doesn't have run.sh. If I copy run.sh as well >>>> along with Dockerfile from github, does it have any other dependency. >>>> >>>> On Wed, Nov 17, 2021 at 4:51 PM Stephen Darlington < >>>> stephen.darling...@gridgain.com> wrote: >>>> >>>>> I’d just take the original Dockerfile (Dockerfile >>>>> <https://github.com/apache/ignite/blob/master/deliveries/docker/apache-ignite/x86_64/Dockerfile>) >>>>> and replace the reference to Java 8 with Java 11 >>>>> >>>>> On 17 Nov 2021, at 10:50, Surinder Mehra <redni...@gmail.com> wrote: >>>>> >>>>> Hi, >>>>> I tried to build one with two approaches. I was thinking the 1st one >>>>> is simple and should work but it didn't so I tried the 2nd approach which >>>>> seems to be missing something. Can you point out the missing piece please. >>>>> >>>>> 1. Extend base image and update java home as below >>>>> FROM apacheignite/ignite >>>>> >>>>> ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64 >>>>> # Install OpenJDK-11 >>>>> RUN apt-get update && \ >>>>> apt-get install -y openjdk-11-jdk && \ >>>>> export JAVA_HOME && \ >>>>> apt-get clean; >>>>> RUN export JAVA_HOME="$(dirname $(dirname $(readlink -f $(which >>>>> java))))" >>>>> >>>>> This throws an error "apt-get not found". I tried with yum as well, >>>>> but it throws the same error. Not sure why it doesn't have package manager >>>>> >>>>> 2. On the 2nd approach I tried to use jdk11 as base image and install >>>>> ignite on it and run /bin/ignite.sh. It throws an error saying it cant >>>>> find >>>>> executable on path. >>>>> >>>>> FROM adoptopenjdk/openjdk11 >>>>> >>>>> # Set Apache Ignite configuration file name. >>>>> ARG IGNITE_CFG_XML="node-configuration.xml" >>>>> >>>>> # Set Apache Ignite version. >>>>> ARG IGNITE_VERSION="2.11.0" >>>>> >>>>> # Set IGNITE_HOME variable. >>>>> ENV IGNITE_HOME /opt/ignite/apache-ignite-${IGNITE_VERSION}-bin >>>>> >>>>> # Set a path to the Apache Ignite configuration file. Use the run.sh >>>>> script below: >>>>> ENV CONFIG_URI ${IGNITE_HOME}/config/$IGNITE_CFG_XML >>>>> >>>>> # Make sure the Kubernetes lib is copied to the 'libs' folder. >>>>> #ENV OPTION_LIBS ignite-kubernetes >>>>> >>>>> # Disabling quiet mode. >>>>> ENV IGNITE_QUIET=false >>>>> WORKDIR /opt/ignite >>>>> # Install or update needed tools. >>>>> #RUN apt-get update && apt-get install -y --no-install-recommends unzip >>>>> RUN apt-get update && \ >>>>> apt-get install -y wget && \ >>>>> apt-get install unzip && \ >>>>> wget >>>>> https://dlcdn.apache.org//ignite/${IGNITE_VERSION}/apache-ignite-${IGNITE_VERSION}-bin.zip >>>>> # Creating and setting a working directory for following commands. >>>>> >>>>> # Copying local Apache Ignite build to the docker image. >>>>> #COPY ./apache-ignite-${IGNITE_VERSION}-bin.zip >>>>> apache-ignite-${IGNITE_VERSION}-bin.zip >>>>> >>>>> # Unpacking the build. >>>>> RUN unzip apache-ignite-${IGNITE_VERSION}-bin.zip >>>>> RUN rm apache-ignite-${IGNITE_VERSION}-bin.zip >>>>> >>>>> # Copying the executable file and setting permissions. >>>>> >>>>> RUN chmod +x $IGNITE_HOME/bin/ignite.sh >>>>> >>>>> # Copy the configuration. >>>>> #COPY ./$IGNITE_CFG_XML $IGNITE_HOME/config >>>>> >>>>> #RUN $IGNITE_HOME/bin/ignite.sh >>>>> # Start an Apache Ignite node. >>>>> CMD $IGNITE_HOME/bin/ignite.sh >>>>> #$IGNITE_HOME/config/$IGNITE_CFG_XML >>>>> >>>>> # Exposing the ports. >>>>> #EXPOSE 11211 47100 47500 49112 >>>>> EXPOSE 10800 11211 47100 11211 47100 47500 49112 >>>>> >>>>> >>>>> >>>>> On Tue, Nov 16, 2021 at 3:51 PM Stephen Darlington < >>>>> stephen.darling...@gridgain.com> wrote: >>>>> >>>>>> I don’t see an image with Java 11. I think you’d have to build your >>>>>> own. >>>>>> >>>>>> There are tickets for this: >>>>>> https://issues.apache.org/jira/browse/IGNITE-14031 and >>>>>> https://issues.apache.org/jira/browse/IGNITE-15209 >>>>>> >>>>>> On 16 Nov 2021, at 09:55, Surinder Mehra <redni...@gmail.com> wrote: >>>>>> >>>>>> Hi, >>>>>> I followed below link to deploy ignite pod on kubernetes. It uses >>>>>> apache ignite 2.11 docker image which has java openjdk 8. Is there a way >>>>>> to >>>>>> configure java 11 on this pod or ignite image with jdk11 ? >>>>>> >>>>>> >>>>>> https://ignite.apache.org/docs/latest/installation/kubernetes/amazon-eks-deployment >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>