Thursday, 1 August 2024

flink + java 17 image

 

Installing Apache Flink 1.20.0 with Java 17 on macOS Using Podman

Prerequisites

  • Podman installed on macOS.

Step 1: Create the Dockerfile

  1. Open a terminal and create a new directory for your Dockerfile:

    bash
    mkdir flink-java17 && cd flink-java17
  2. Create a file named Dockerfile with the following content:

    dockerfile
    FROM openjdk:17-jdk as base RUN apt-get update && apt-get install -y curl RUN curl -O https://dlcdn.apache.org/flink/flink-1.20.0/flink-1.20.0-bin-scala_2.12.tgz && \ tar -xzf flink-1.20.0-bin-scala_2.12.tgz && \ mv flink-1.20.0 /opt/flink ENV FLINK_HOME=/opt/flink ENV PATH="$FLINK_HOME/bin:$PATH"

Step 2: Build the Docker Image

Run the following command in the terminal to build the image:

bash
podman build -t flink-java17:1.20.0 .

Step 3: Run the Flink JobManager

Start the JobManager container:

bash
podman run -d --name flink-jobmanager -p 8081:8081 flink-java17:1.20.0 jobmanager

Step 4: Run the Flink TaskManager

Start the TaskManager container:

bash
podman run -d --name flink-taskmanager --link flink-jobmanager:jobmanager flink-java17:1.20.0 taskmanager

Step 5: Access the Flink Web Interface

You can access the Flink web interface by opening a web browser and navigating to:

arduino
http://localhost:8081

Conclusion

You have successfully set up Apache Flink version 1.20.0 with Java 17 using Podman on macOS. If you encounter any issues or have further questions, feel free to ask!




# 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 path/to/java17 /opt/java17


# Verify Java installation (optional)

RUN java -version


No comments:

Post a Comment