SlideShare a Scribd company logo
IBM Confidential 1
Apache Flink Cluster Deployment
On Docker and Docker-Compose
Simon Laws
simon_laws@uk.ibm.com
© 2014 IBM Corporation
What We’re Going To Build
2
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Docker
3
docker.com
© 2014 IBM Corporation
Docker
4
docker.com/
whatisdocker
© 2014 IBM Corporation
IBM Bluemix
Sign up for a free
account and experiment
5
bluemix.net
© 2014 IBM Corporation
IBM Bluemix Signup
Sign up for a free
account and experiment
Various options for
academics, startups etc.
Prices here for when
you go over free
allocation
https://console.eu-
gb.bluemix.net/pricing/
6
https://console.ng.bluemix.net/registration/
© 2014 IBM Corporation
Apache Flink and Docker
7
github.com/apache/
flink/tree/master/
flink-contrib/
docker-flink
© 2014 IBM Corporation
Install Ubuntu Using VirtualBox
8
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Setting Up The Host Operating System
 If you’re on Linux you’re probably good to go
 If you’re on Windows or OSX you need to run Linux on a VM
 As an alternative you could do this on a VM in the new VM service in Bluemix. It’s in Beta at the moment.
 Get VirtualBox
 Create a Linux VM (I used Ubuntu)
 Install Docker
 Download Flink Source
 Try a Flink example
9
© 2014 IBM Corporation
Get VirtualBox
10
virtualbox.org
© 2014 IBM Corporation
Get Linux Distro (I went for Ubuntu 14.04)
11
releases.ubuntu.com/14.04
© 2014 IBM Corporation
Create VM from ISO in VirtualBox (and set port forwarding)
12
End result is that I can now SSH into the instance of
Ubuntu running inside VitualBox. Everything for this
point on happens inside this Ubuntu VM
To start with make sure that Ubuntu is up to date
> sudo su -
> apt-get update
sudo su -
apt-get updatesudo su -
apt-get update
© 2014 IBM Corporation
Install Docker and Flink
13
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Install Docker and Docker-Compose
14
github.com/apache/
flink/tree/master/
flink-contrib/
docker-flink
© 2014 IBM Corporation
Download Flink Source
15
git clone https://github.com/apache/flink.git
cd flink/flink-contrib/docker-flink The base Docker image
source
Builds the “base” and “flink”
images
The flink Docker image
source
Docker-Compose
configuration
© 2014 IBM Corporation
Docker Images and Containers
16
Source
Docker
Image
Docker
Container
docker build docker run
What Images
Do I have?
docker images
What Containers
Do I have running?
Push elsewhere (Docker Hub)
To share with others
ssh or
docker exec
docker psDockerfile
© 2014 IBM Corporation
Dockerfiles – The Recipe for a Docker Image
17
© 2014 IBM Corporation
Build Docker Images
18
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Building The Images From the Docker Files
19
./build.sh
If you look in the script it use the “docker build” command to build a “base” image and a
“flink” image
This failed for me on the first attempt with the base build reporting
chpasswd: (user root) pam_chauthtok() failed, error:
System error
chpasswd: (line 1, user root) password not changed
It turned out I had an old version of Docker so I updated to latest and it worked
© 2014 IBM Corporation
The Built Images
20
© 2014 IBM Corporation
Run Docker Containers
21
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Running Linked Images Manually (To See What’s Going On)
22
docker run -d -p 48080:8080 -p 48081:8081 --expose 6123 --name
jobmanager flink /usr/local/flink/bin/config-flink.sh jobmanager
docker run -d --expose 6121 --expose 6122 --link jobmanager --name
taskmanager1 flink
The job manager
Add a task manager
This failed at first with a strange “Exec format exception”. I made a local fix by removing
the comment from the top of the flink/config-flink.sh file leaving
#!/bin/bash
As the first line
© 2014 IBM Corporation
Flink up and Running
23
© 2014 IBM Corporation
Running a Test
24
I had previously uploaded flink-java-examples-0.9.1-WordCount.jar from my local Windows install of Flink
© 2014 IBM Corporation
Accessing Containers with Docker Exec
25
© 2014 IBM Corporation
Making Things Simpler With Docker-Compose
26
docker-compose up –d
docker-compose scale taskmanager=3
docker-compose kill
© 2014 IBM Corporation
Connecting To Bluemix
27
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Running the Images On Bluemix
28
Log in to Bluemix:
1.cf login
Run the IBM Containers cf CLI plug-in.
2.cf ic login
Create a Dockerfile in the root directory of your app source files. Learn more about Dockerfiles.
Build an image from your Dockerfile. The command returns an image ID.
3. docker build -t image_name
Tag the image with your private namespace in the IBM Containers registry.
4. docker tag image_name registry.stage1.ng.bluemix.net/sluk/image_name:image_tag
The image name is optional. If it is not specified, the image is tagged with latest.
Push this image to the IBM Containers registry:
5. docker push registry.stage1.ng.bluemix.net/sluk/image_name:image_tag
You can create a container from this image in the Bluemix Catalog, or with the following command:
6. cf ic run --name container_name
registry.stage1.ng.bluemix.net/sluk/image_name:image_tag
© 2014 IBM Corporation
Install The Cloud Foundary Client Software
29
In the Ubuntu VM we have been using to run Flink using Docker get and install the Cloud
Foundary client tool
wget --output-document=cfcli.deb
https://cli.run.pivotal.io/stable?release=debian64&version=6.12.4&source=githu
b-rel
dpkg -i cfcli.deb
In the Ubuntu VM we have been using to run Flink using Docker get
and install the Cloud Foundary client
cf install-plugin https://static-ice.ng.bluemix.net/ibm-containers-linux_x64
© 2014 IBM Corporation
Log Into Bluemix – Web User Interface
30
© 2014 IBM Corporation
Log Into Bluemix – Command Line Using CF Tool
31
© 2014 IBM Corporation
Log Into Bluemix Containers – Command Line Using CF Tool
32
© 2014 IBM Corporation
Push Image Up To Bluemix
33
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Tag and Push Up Our Images
34
docker tag flink registry.ng.bluemix.net/sluk/flink
docker push registry.ng.bluemix.net/sluk/flink
© 2014 IBM Corporation
List Images Now Up On Bluemix
35
cf ic images
© 2014 IBM Corporation
Run Containers On Bluemix
36
Windows 7 IBM Bluemix
VirtualBox 4.3.18
Ubuntu 14.04
Docker 4.3.18
Cygwin
ssh
Flink
Jobmanager
container
Flink
Taskmanager
container
Cloudfoundry
Client
Docker
Flink
image
Flink
Jobmanager
container
Flink
Taskmanager
container
Flink
image
© 2014 IBM Corporation
Creating Containers in Bluemix via User Interface
37
© 2014 IBM Corporation
Creating Containers in Bluemix via CF Command Line
38
Option 1) Leverage this Cloud Foundry IBM Containers plugin without affecting the local docker environment:
Example Usage:
cf ic ps
cf ic images
Option 2) Leverage the docker CLI directly. In this shell, override local docker environment to connect to IBM
Containers by setting these variables,
export DOCKER_HOST=tcp://containers-api.ng.bluemix.net:8443
export DOCKER_CERT_PATH=/root/.ice/certs
export DOCKER_TLS_VERIFY=1
Example Usage:
docker ps
docker images
© 2014 IBM Corporation39
Create jobmanager Container in Bluemix via CF Command Line
cf ic run -p 22:22 -p 8080:8080 -p 8081:8081 -p 6123:6123 --expose
6123 --name jobmanager registry.ng.bluemix.net/sluk/flink
/usr/local/flink/bin/config-flink.sh jobmanager
Assign a public IP
so you can get
to the console
© 2014 IBM Corporation40
Create taskmanager Container in Bluemix via CF Command Line
cf ic run -p 22:22 -p 6121:6121 -p 6122:6122 --expose 6121 --
expose 6122 --name taskmanager1 --link jobmanager:jobmanager
registry.ng.bluemix.net/sluk/flink /usr/local/flink/bin/config-
flink.sh taskmanager
© 2014 IBM Corporation
Running The Flink Cluster
41
© 2014 IBM Corporation
QUESTIONS?
42

More Related Content

PPT
Step-by-Step Introduction to Apache Flink
PDF
Tame the small files problem and optimize data layout for streaming ingestion...
PPT
Implementing Semantic Search
PDF
What's New in Apache Hive
PPTX
Apache Flink in the Cloud-Native Era
PPTX
Simplify DevOps with Microservices and Mobile Backends.pptx
PPTX
Apache Kafka Best Practices
PPTX
SQL-on-Hadoop Tutorial
Step-by-Step Introduction to Apache Flink
Tame the small files problem and optimize data layout for streaming ingestion...
Implementing Semantic Search
What's New in Apache Hive
Apache Flink in the Cloud-Native Era
Simplify DevOps with Microservices and Mobile Backends.pptx
Apache Kafka Best Practices
SQL-on-Hadoop Tutorial

What's hot (20)

PDF
Common Strategies for Improving Performance on Your Delta Lakehouse
PDF
Modern Data Pipelines
PDF
Delta Lake: Optimizing Merge
PPTX
Best practices and lessons learnt from Running Apache NiFi at Renault
PDF
Making Data Timelier and More Reliable with Lakehouse Technology
PDF
Changing the game with cloud dw
PPTX
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
PPTX
Google Cloud Composer
PDF
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
PDF
Real-time Data Ingestion from Kafka to ClickHouse with Deterministic Re-tries...
PPTX
Tuning Apache Kafka Connectors for Flink.pptx
PDF
Alfresco Backup and Disaster Recovery White Paper
PDF
Airflow Best Practises & Roadmap to Airflow 2.0
PPTX
Graylog Engineering - Design Your Architecture
PDF
Fast Data – Fast Cars: Wie Apache Kafka die Datenwelt revolutioniert
PDF
Designing Structured Streaming Pipelines—How to Architect Things Right
PPTX
Apache Calcite overview
PDF
Understanding Query Plans and Spark UIs
PPTX
PDF
Apache Kafka Architecture & Fundamentals Explained
Common Strategies for Improving Performance on Your Delta Lakehouse
Modern Data Pipelines
Delta Lake: Optimizing Merge
Best practices and lessons learnt from Running Apache NiFi at Renault
Making Data Timelier and More Reliable with Lakehouse Technology
Changing the game with cloud dw
Demystifying flink memory allocation and tuning - Roshan Naik, Uber
Google Cloud Composer
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
Real-time Data Ingestion from Kafka to ClickHouse with Deterministic Re-tries...
Tuning Apache Kafka Connectors for Flink.pptx
Alfresco Backup and Disaster Recovery White Paper
Airflow Best Practises & Roadmap to Airflow 2.0
Graylog Engineering - Design Your Architecture
Fast Data – Fast Cars: Wie Apache Kafka die Datenwelt revolutioniert
Designing Structured Streaming Pipelines—How to Architect Things Right
Apache Calcite overview
Understanding Query Plans and Spark UIs
Apache Kafka Architecture & Fundamentals Explained
Ad

Viewers also liked (20)

PPTX
Apache Flink: API, runtime, and project roadmap
PDF
Mohamed Amine Abdessemed – Real-time Data Integration with Apache Flink & Kafka
PPTX
Apache Flink Training: DataStream API Part 1 Basic
PPTX
Slim Baltagi – Flink vs. Spark
PDF
Marton Balassi – Stateful Stream Processing
PDF
Maximilian Michels – Google Cloud Dataflow on Top of Apache Flink
PDF
Matthias J. Sax – A Tale of Squirrels and Storms
PDF
Jim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
PDF
Fabian Hueske – Juggling with Bits and Bytes
PPTX
Flink 0.10 @ Bay Area Meetup (October 2015)
PDF
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
PPTX
Fabian Hueske – Cascading on Flink
PPTX
Apache Flink - Hadoop MapReduce Compatibility
PPTX
Assaf Araki – Real Time Analytics at Scale
PPTX
Apache Flink Training: System Overview
PDF
Anwar Rizal – Streaming & Parallel Decision Tree in Flink
PDF
Vyacheslav Zholudev – Flink, a Convenient Abstraction Layer for Yarn?
PPTX
Apache Flink Training: DataStream API Part 2 Advanced
PPTX
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
PPTX
Kamal Hakimzadeh – Reproducible Distributed Experiments
Apache Flink: API, runtime, and project roadmap
Mohamed Amine Abdessemed – Real-time Data Integration with Apache Flink & Kafka
Apache Flink Training: DataStream API Part 1 Basic
Slim Baltagi – Flink vs. Spark
Marton Balassi – Stateful Stream Processing
Maximilian Michels – Google Cloud Dataflow on Top of Apache Flink
Matthias J. Sax – A Tale of Squirrels and Storms
Jim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
Fabian Hueske – Juggling with Bits and Bytes
Flink 0.10 @ Bay Area Meetup (October 2015)
Sebastian Schelter – Distributed Machine Learing with the Samsara DSL
Fabian Hueske – Cascading on Flink
Apache Flink - Hadoop MapReduce Compatibility
Assaf Araki – Real Time Analytics at Scale
Apache Flink Training: System Overview
Anwar Rizal – Streaming & Parallel Decision Tree in Flink
Vyacheslav Zholudev – Flink, a Convenient Abstraction Layer for Yarn?
Apache Flink Training: DataStream API Part 2 Advanced
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
Kamal Hakimzadeh – Reproducible Distributed Experiments
Ad

Similar to Simon Laws – Apache Flink Cluster Deployment on Docker and Docker-Compose (20)

PPTX
WebSphere Application Server Liberty Profile and Docker
PPT
Connect to blumix docker container with putty
PPTX
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
PPTX
Develop with docker 2014 aug
PDF
How to Install and Use Docker Compose on Ubuntu 2404.pdf
PDF
Bring Continuous Integration to Your Laptop With the Drone CI Docker Extensio...
PPSX
Docker and containers - Presentation Slides by Priyadarshini Anand
PPTX
Academy PRO: Docker. Part 4
PDF
Managing Docker containers
PPT
Run windows vm on bluemix
PPT
Using java to access bluemix object storage v2
PPTX
IBM Container Service Overview
PPTX
Release webinar architecture
PPTX
Docker containers on Windows
PDF
Faster and Easier Software Development using Docker Platform
PDF
Using Podman with Alfresco
PDF
BBL Premiers pas avec Docker
PDF
Environment isolation with Docker (Alex Medvedev, Alpari)
PPTX
Academy PRO: Docker. Lecture 4
PPTX
IBM MQ in containers MQTC 2017
WebSphere Application Server Liberty Profile and Docker
Connect to blumix docker container with putty
Phoenix 1.3 Umbrella App deployment via Distillery-Docker-Docker_Compose
Develop with docker 2014 aug
How to Install and Use Docker Compose on Ubuntu 2404.pdf
Bring Continuous Integration to Your Laptop With the Drone CI Docker Extensio...
Docker and containers - Presentation Slides by Priyadarshini Anand
Academy PRO: Docker. Part 4
Managing Docker containers
Run windows vm on bluemix
Using java to access bluemix object storage v2
IBM Container Service Overview
Release webinar architecture
Docker containers on Windows
Faster and Easier Software Development using Docker Platform
Using Podman with Alfresco
BBL Premiers pas avec Docker
Environment isolation with Docker (Alex Medvedev, Alpari)
Academy PRO: Docker. Lecture 4
IBM MQ in containers MQTC 2017

More from Flink Forward (20)

PDF
Building a fully managed stream processing platform on Flink at scale for Lin...
PPTX
Evening out the uneven: dealing with skew in Flink
PPTX
“Alexa, be quiet!”: End-to-end near-real time model building and evaluation i...
PDF
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
PDF
Introducing the Apache Flink Kubernetes Operator
PPTX
Autoscaling Flink with Reactive Mode
PDF
Dynamically Scaling Data Streams across Multiple Kafka Clusters with Zero Fli...
PPTX
One sink to rule them all: Introducing the new Async Sink
PDF
Flink powered stream processing platform at Pinterest
PPTX
Where is my bottleneck? Performance troubleshooting in Flink
PPTX
Using the New Apache Flink Kubernetes Operator in a Production Deployment
PPTX
The Current State of Table API in 2022
PDF
Flink SQL on Pulsar made easy
PPTX
Dynamic Rule-based Real-time Market Data Alerts
PPTX
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
PPTX
Processing Semantically-Ordered Streams in Financial Services
PDF
Batch Processing at Scale with Flink & Iceberg
PPTX
Welcome to the Flink Community!
PPTX
Practical learnings from running thousands of Flink jobs
PPTX
Extending Flink SQL for stream processing use cases
Building a fully managed stream processing platform on Flink at scale for Lin...
Evening out the uneven: dealing with skew in Flink
“Alexa, be quiet!”: End-to-end near-real time model building and evaluation i...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing the Apache Flink Kubernetes Operator
Autoscaling Flink with Reactive Mode
Dynamically Scaling Data Streams across Multiple Kafka Clusters with Zero Fli...
One sink to rule them all: Introducing the new Async Sink
Flink powered stream processing platform at Pinterest
Where is my bottleneck? Performance troubleshooting in Flink
Using the New Apache Flink Kubernetes Operator in a Production Deployment
The Current State of Table API in 2022
Flink SQL on Pulsar made easy
Dynamic Rule-based Real-time Market Data Alerts
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Processing Semantically-Ordered Streams in Financial Services
Batch Processing at Scale with Flink & Iceberg
Welcome to the Flink Community!
Practical learnings from running thousands of Flink jobs
Extending Flink SQL for stream processing use cases

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
A Presentation on Artificial Intelligence
PDF
Electronic commerce courselecture one. Pdf
PPTX
Machine Learning_overview_presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Unlocking AI with Model Context Protocol (MCP)
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Empathic Computing: Creating Shared Understanding
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
A Presentation on Artificial Intelligence
Electronic commerce courselecture one. Pdf
Machine Learning_overview_presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Digital-Transformation-Roadmap-for-Companies.pptx
Cloud computing and distributed systems.
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Unlocking AI with Model Context Protocol (MCP)
The AUB Centre for AI in Media Proposal.docx
Mobile App Security Testing_ A Comprehensive Guide.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A comparative analysis of optical character recognition models for extracting...
Empathic Computing: Creating Shared Understanding
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Simon Laws – Apache Flink Cluster Deployment on Docker and Docker-Compose

  • 1. IBM Confidential 1 Apache Flink Cluster Deployment On Docker and Docker-Compose Simon Laws [email protected]
  • 2. © 2014 IBM Corporation What We’re Going To Build 2 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 3. © 2014 IBM Corporation Docker 3 docker.com
  • 4. © 2014 IBM Corporation Docker 4 docker.com/ whatisdocker
  • 5. © 2014 IBM Corporation IBM Bluemix Sign up for a free account and experiment 5 bluemix.net
  • 6. © 2014 IBM Corporation IBM Bluemix Signup Sign up for a free account and experiment Various options for academics, startups etc. Prices here for when you go over free allocation https://console.eu- gb.bluemix.net/pricing/ 6 https://console.ng.bluemix.net/registration/
  • 7. © 2014 IBM Corporation Apache Flink and Docker 7 github.com/apache/ flink/tree/master/ flink-contrib/ docker-flink
  • 8. © 2014 IBM Corporation Install Ubuntu Using VirtualBox 8 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 9. © 2014 IBM Corporation Setting Up The Host Operating System  If you’re on Linux you’re probably good to go  If you’re on Windows or OSX you need to run Linux on a VM  As an alternative you could do this on a VM in the new VM service in Bluemix. It’s in Beta at the moment.  Get VirtualBox  Create a Linux VM (I used Ubuntu)  Install Docker  Download Flink Source  Try a Flink example 9
  • 10. © 2014 IBM Corporation Get VirtualBox 10 virtualbox.org
  • 11. © 2014 IBM Corporation Get Linux Distro (I went for Ubuntu 14.04) 11 releases.ubuntu.com/14.04
  • 12. © 2014 IBM Corporation Create VM from ISO in VirtualBox (and set port forwarding) 12 End result is that I can now SSH into the instance of Ubuntu running inside VitualBox. Everything for this point on happens inside this Ubuntu VM To start with make sure that Ubuntu is up to date > sudo su - > apt-get update sudo su - apt-get updatesudo su - apt-get update
  • 13. © 2014 IBM Corporation Install Docker and Flink 13 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 14. © 2014 IBM Corporation Install Docker and Docker-Compose 14 github.com/apache/ flink/tree/master/ flink-contrib/ docker-flink
  • 15. © 2014 IBM Corporation Download Flink Source 15 git clone https://github.com/apache/flink.git cd flink/flink-contrib/docker-flink The base Docker image source Builds the “base” and “flink” images The flink Docker image source Docker-Compose configuration
  • 16. © 2014 IBM Corporation Docker Images and Containers 16 Source Docker Image Docker Container docker build docker run What Images Do I have? docker images What Containers Do I have running? Push elsewhere (Docker Hub) To share with others ssh or docker exec docker psDockerfile
  • 17. © 2014 IBM Corporation Dockerfiles – The Recipe for a Docker Image 17
  • 18. © 2014 IBM Corporation Build Docker Images 18 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 19. © 2014 IBM Corporation Building The Images From the Docker Files 19 ./build.sh If you look in the script it use the “docker build” command to build a “base” image and a “flink” image This failed for me on the first attempt with the base build reporting chpasswd: (user root) pam_chauthtok() failed, error: System error chpasswd: (line 1, user root) password not changed It turned out I had an old version of Docker so I updated to latest and it worked
  • 20. © 2014 IBM Corporation The Built Images 20
  • 21. © 2014 IBM Corporation Run Docker Containers 21 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 22. © 2014 IBM Corporation Running Linked Images Manually (To See What’s Going On) 22 docker run -d -p 48080:8080 -p 48081:8081 --expose 6123 --name jobmanager flink /usr/local/flink/bin/config-flink.sh jobmanager docker run -d --expose 6121 --expose 6122 --link jobmanager --name taskmanager1 flink The job manager Add a task manager This failed at first with a strange “Exec format exception”. I made a local fix by removing the comment from the top of the flink/config-flink.sh file leaving #!/bin/bash As the first line
  • 23. © 2014 IBM Corporation Flink up and Running 23
  • 24. © 2014 IBM Corporation Running a Test 24 I had previously uploaded flink-java-examples-0.9.1-WordCount.jar from my local Windows install of Flink
  • 25. © 2014 IBM Corporation Accessing Containers with Docker Exec 25
  • 26. © 2014 IBM Corporation Making Things Simpler With Docker-Compose 26 docker-compose up –d docker-compose scale taskmanager=3 docker-compose kill
  • 27. © 2014 IBM Corporation Connecting To Bluemix 27 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 28. © 2014 IBM Corporation Running the Images On Bluemix 28 Log in to Bluemix: 1.cf login Run the IBM Containers cf CLI plug-in. 2.cf ic login Create a Dockerfile in the root directory of your app source files. Learn more about Dockerfiles. Build an image from your Dockerfile. The command returns an image ID. 3. docker build -t image_name Tag the image with your private namespace in the IBM Containers registry. 4. docker tag image_name registry.stage1.ng.bluemix.net/sluk/image_name:image_tag The image name is optional. If it is not specified, the image is tagged with latest. Push this image to the IBM Containers registry: 5. docker push registry.stage1.ng.bluemix.net/sluk/image_name:image_tag You can create a container from this image in the Bluemix Catalog, or with the following command: 6. cf ic run --name container_name registry.stage1.ng.bluemix.net/sluk/image_name:image_tag
  • 29. © 2014 IBM Corporation Install The Cloud Foundary Client Software 29 In the Ubuntu VM we have been using to run Flink using Docker get and install the Cloud Foundary client tool wget --output-document=cfcli.deb https://cli.run.pivotal.io/stable?release=debian64&version=6.12.4&source=githu b-rel dpkg -i cfcli.deb In the Ubuntu VM we have been using to run Flink using Docker get and install the Cloud Foundary client cf install-plugin https://static-ice.ng.bluemix.net/ibm-containers-linux_x64
  • 30. © 2014 IBM Corporation Log Into Bluemix – Web User Interface 30
  • 31. © 2014 IBM Corporation Log Into Bluemix – Command Line Using CF Tool 31
  • 32. © 2014 IBM Corporation Log Into Bluemix Containers – Command Line Using CF Tool 32
  • 33. © 2014 IBM Corporation Push Image Up To Bluemix 33 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 34. © 2014 IBM Corporation Tag and Push Up Our Images 34 docker tag flink registry.ng.bluemix.net/sluk/flink docker push registry.ng.bluemix.net/sluk/flink
  • 35. © 2014 IBM Corporation List Images Now Up On Bluemix 35 cf ic images
  • 36. © 2014 IBM Corporation Run Containers On Bluemix 36 Windows 7 IBM Bluemix VirtualBox 4.3.18 Ubuntu 14.04 Docker 4.3.18 Cygwin ssh Flink Jobmanager container Flink Taskmanager container Cloudfoundry Client Docker Flink image Flink Jobmanager container Flink Taskmanager container Flink image
  • 37. © 2014 IBM Corporation Creating Containers in Bluemix via User Interface 37
  • 38. © 2014 IBM Corporation Creating Containers in Bluemix via CF Command Line 38 Option 1) Leverage this Cloud Foundry IBM Containers plugin without affecting the local docker environment: Example Usage: cf ic ps cf ic images Option 2) Leverage the docker CLI directly. In this shell, override local docker environment to connect to IBM Containers by setting these variables, export DOCKER_HOST=tcp://containers-api.ng.bluemix.net:8443 export DOCKER_CERT_PATH=/root/.ice/certs export DOCKER_TLS_VERIFY=1 Example Usage: docker ps docker images
  • 39. © 2014 IBM Corporation39 Create jobmanager Container in Bluemix via CF Command Line cf ic run -p 22:22 -p 8080:8080 -p 8081:8081 -p 6123:6123 --expose 6123 --name jobmanager registry.ng.bluemix.net/sluk/flink /usr/local/flink/bin/config-flink.sh jobmanager Assign a public IP so you can get to the console
  • 40. © 2014 IBM Corporation40 Create taskmanager Container in Bluemix via CF Command Line cf ic run -p 22:22 -p 6121:6121 -p 6122:6122 --expose 6121 -- expose 6122 --name taskmanager1 --link jobmanager:jobmanager registry.ng.bluemix.net/sluk/flink /usr/local/flink/bin/config- flink.sh taskmanager
  • 41. © 2014 IBM Corporation Running The Flink Cluster 41
  • 42. © 2014 IBM Corporation QUESTIONS? 42