Docker環境でApache NiFiを起動

## Install Docker

Docker in CentOS 7:
OS: CentOS 7.x

```bash
#!/usr/bin/env bash


# Install Docker
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

# sudo yum install docker -y
# sudo systemctl enable docker

# yum remove docker docker-common
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo systemctl enable docker
sudo systemctl start docker

```

Install Docker in Mac:
https://docs.docker.jp/docker-for-mac/toc.html

## Install NiFi Docker

```bash


# Install NiFi Docker
# https://hub.docker.com/r/apache/nifi/
docker run --name nifi \
  -p 8080:8080 \
  -d \
  apache/nifi:latest


# Access: Use
# http://hostname:8080/nifi/

# もし8080以外のポートが良い場合、指定することも可能です。例：9090 port
sudo docker run --name nifi -p 9090:9090 -d -e NIFI_WEB_HTTP_PORT='9090' apache/nifi:latest

```

CentOS 7.5のインストール画面

```bash
[root@zzeng-nipy ~]$ docker run --name nifi \
>   -p 8080:8080 \
>   -d \
>   apache/nifi:latest
Unable to find image 'apache/nifi:latest' locally
latest: Pulling from apache/nifi
741437d97401: Pull complete
34d8874714d7: Pull complete
0a108aa26679: Pull complete
eea0f08c7492: Pull complete
ca74b3d90c15: Pull complete
f11a643c4a85: Pull complete
05eafed73b65: Pull complete
c5ddb7ebf4a2: Pull complete
078ec62a70f5: Pull complete
a4904daa3c74: Pull complete
6ee7d3c8cf48: Pull complete
f1d46c7cfa83: Pull complete
Digest: sha256:85e22b320d9d44638e4847b6eb26800428d9bda61c100732a58c387fa8871ddc
Status: Downloaded newer image for apache/nifi:latest
b0964bb23aabbdfb67702153273c3c67a5276b2b55ae7d9bf8684110c5104a04
```

## NiFi 2.0 起動

https://hub.docker.com/layers/apache/nifi/2.0.0/images/sha256-322b9389206be69ab67b4d73dbe49517dd4cefaf2c3ef80646a38d82c9608b0a
```bash
docker run --name nifi \
   -p 8080:8080 \
   -d \
   apache/nifi:2.0.0

```

実行：
```bash
[zzeng@zeng-mbp ~]$ docker run --name nifi \
>    -p 8080:8080 \
>    -d \
>    apache/nifi:2.0.0
Unable to find image 'apache/nifi:2.0.0' locally
2.0.0: Pulling from apache/nifi
76475c2689e2: Pull complete
ed3c8a43ccee: Pull complete
cdbaed79dfce: Pull complete
091df5b8290c: Pull complete
83543f6e1827: Pull complete
3bb0e389e0ca: Pull complete
7b0920a6cb85: Pull complete
28d000657440: Pull complete
d0fca6530e51: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:cf8f4ce74cf34712766c8aba016c0c5efb8f73d6c2392e2108a809fff242875c
Status: Downloaded newer image for apache/nifi:2.0.0
docker: Error response from daemon: Conflict. The container name "/nifi" is already in use by container "7cd27117c7f64b6162c3d749d34062cedd1893eb579d07727f863da6b7bf4cda". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
[zzeng@zeng-mbp ~]$
```


Mac環境のInstall画面：
<img width="907" alt="image.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/133516/ee45ed72-3f2d-3680-9618-1b3f3094b51e.png">


## NiFi のWeb画面に入る

http://hostname:8080/nifi/

Mac環境でしたら、Localhostでも行けます：
http://localhost:8080/nifi/

<img width="1419" alt="image.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/133516/dbd53d02-d7ed-433b-bbb8-c5c2859bb876.png">

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/133516/9ce41de9-71f9-0107-7c4a-46e52a99e040.png)