I am using Flink 1.20.0 with Java 11. I have downloaded JDK 17 locally using jdk-17.0.12_linux-aarch64_bin.tar.gz, unzipped it, and during the creation of a container using Podman, I am copying the JDK to the opt directory. I want to set the path for the new JDK 17 permanently. I am able to set the path for the session only.
I have tried using the -e option with Podman when creating the container and setting the variables, but the container is not starting. This might be because the jdk-17.0.12 folder is not present after creating the container.
podman run -d -e JAVA_HOME=/opt/$JAVA_DIR_NAME/jdk-17.0.12 -e PATH=/opt/flink/bin:/opt/jdk-17/jdk-17.0.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -p 8081:8081 -p 6123:6123 --name testmanager flink:1.20.0 testmanager
I also tried the following commands, but they did not work:
podman exec -it $JOBMANAGER_CONTAINER_NAME bash -c "echo 'export JAVA_HOME=/opt/$JAVA_DIR_NAME/jdk-17.0.12' >> /etc/profile"
podman exec -it $JOBMANAGER_CONTAINER_NAME bash -c "echo 'export PATH=\$JAVA_HOME/bin:\$PATH' >> /etc/profile"
podman exec -it $JOBMANAGER_CONTAINER_NAME bash -c "source /etc/profile"
If I SSH into the container, I can set PATH and JAVA_HOME, but it is only for the session, not permanent. Please help me set PATH and JAVA_HOME permanently for all users and sessions.
I am using Flink 1.20.0 with Java 11. I have downloaded JDK 17 locally using jdk-17.0.12_linux-aarch64_bin.tar.gz, unzipped it, and during the creation of a container using Podman, I am copying the JDK to the opt directory. I want to set the path for the new JDK 17 permanently. I am able to set the path for the session only.
I have tried using the -e option with Podman when creating the container and setting the variables, but the container is not starting. This might be because the jdk-17.0.12 folder is not present after creating the container.
podman run -d -e JAVA_HOME=/opt/$JAVA_DIR_NAME/jdk-17.0.12 -e PATH=/opt/flink/bin:/opt/jdk-17/jdk-17.0.12/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -p 8081:8081 -p 6123:6123 --name testmanager flink:1.20.0 testmanager
I also tried the following commands, but they did not work:
podman exec -it $JOBMANAGER_CONTAINER_NAME bash -c "echo 'export JAVA_HOME=/opt/$JAVA_DIR_NAME/jdk-17.0.12' >> /etc/profile"
podman exec -it $JOBMANAGER_CONTAINER_NAME bash -c "echo 'export PATH=\$JAVA_HOME/bin:\$PATH' >> /etc/profile"
podman exec -it $JOBMANAGER_CONTAINER_NAME bash -c "source /etc/profile"
If I SSH into the container, I can set PATH and JAVA_HOME, but it is only for the session, not permanent. Please help me set PATH and JAVA_HOME permanently for all users and sessions.
I have created new image for flink:1.20.0 and Java17.
FROM flink:1.20.0
ENV JAVA_HOME=/opt/java17
ENV PATH="$JAVA_HOME/bin:$PATH"
COPY jdk-17/jdk-17.0.12 /opt/java17
RUN java -version