admin管理员组文章数量:1305102
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.
Share Improve this question edited Feb 5 at 18:56 Samu Németh 5701 gold badge5 silver badges20 bronze badges asked Feb 4 at 2:04 MiteshMitesh 133 bronze badges 01 Answer
Reset to default 0I have created new image for flink:1.20.0 and Java17.
Use the Flink 1.20.0 image as the base image
FROM flink:1.20.0
Set the directory where Java 17 will be copied
ENV JAVA_HOME=/opt/java17
ENV PATH="$JAVA_HOME/bin:$PATH"
Copy Java 17 files to the /opt directory
COPY jdk-17/jdk-17.0.12 /opt/java17
Verify Java installation (optional)
RUN java -version
本文标签:
版权声明:本文标题:java - Unable to Permanently Set JAVA_HOME and PATH in Podman Container for Flink 1.20.0 with JDK 17 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741789895a2397598.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论