> For the complete documentation index, see [llms.txt](https://eric-lo.gitbook.io/flink-lab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eric-lo.gitbook.io/flink-lab/start-your-flink-cluster-with-docker.md).

# Start your Flink cluster with docker

A Flink cluster consists of 2 components:

* **JobManager**: Accepts jobs from users. Allocate tasks of job to TaskManager.
* **TaskManager**: Executes the tasks.

![](https://1935376577-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lrg2E3mVHdVtVmKMSyQ%2F-Ls15BazF-OIbq9hFkzH%2F-Ls15C9fy__-nOVC91gC%2Fimage.png?alt=media\&token=b83de8c0-830e-43cc-974e-efbbdc1bd030)

We will use docker to launch 2 containers. 1 for Jobmanager and 1 for Taskmanager.

```bash
git clone https://github.com/hack3ric/CUHK-CSE-Lab-Flink.git
cd CUHK-CSE-Lab-Flink
docker compose up
```

Now, you should see all the standard output and error output from the containers. Don't touch the terminal. Open a new terminal to execute the commands mentioned in the next steps.

In the following section, we need to access Flink WebUI. We need to know the ports that they are listening to. Execute the following command to get the **port of Flink WebUI**:

```bash
docker port <your user name>_jobmanager | grep -o ':[0-9]\+'
```
