https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/try-flink/local_installation/
cat << EOF > /tmp/input.txt
Lorem imsum lorem
EOF
docker network create flink-network
Start JobManager
export FLINK_PROPERTIES="jobmanager.rpc.address: jobmanager"
docker run \
--rm \
--name=jobmanager \
--network flink-network \
--publish 8081:8081 \
-v /tmp/input.txt:/tmp/input.txt:z \
--env FLINK_PROPERTIES="${FLINK_PROPERTIES}" \
flink:1.18.0-scala_2.12-java17 jobmanager
In the new terminal start TaskManager
export FLINK_PROPERTIES="jobmanager.rpc.address: jobmanager"
docker run \
--rm \
--name=taskmanager \
--network flink-network \
-v /tmp/input.txt:/tmp/input.txt:z \
--env FLINK_PROPERTIES="${FLINK_PROPERTIES}" \
flink:1.18.0-scala_2.12-java17 taskmanager
Connect to JobManager
docker exec -it jobmanager bash
and execute example task
./bin/flink run ./examples/streaming/WordCount.jar --input /tmp/input.txt
The result is going to appear in logs of TaskManager:
2023-12-03 16:24:24,460 INFO org.apache.flink.connector.base.source.reader.SourceReaderBase [] - Reader received NoMoreSplits event.
(lorem,1)
(imsum,1)
(lorem,2)