29
Simple Docker hosting on FIWARE Lab Kenneth Nagin IBM Cloud Chapter Lead, FIWARE [email protected]

Simple docker hosting on fiware lab

Embed Size (px)

Citation preview

Page 1: Simple docker hosting on fiware lab

Simple Docker hosting on FIWARE Lab

Kenneth NaginIBMCloud Chapter Lead, [email protected]

Page 2: Simple docker hosting on fiware lab

Content

• Overview

• Basic Set Up

• Docker Engine

• Docker Compose

• Docker Machine

• Docker Swarm

• limitations

2

Page 3: Simple docker hosting on fiware lab

FIWARE Lab Cloud Docker Hosting Overview

• Docker Hub: hosted registry service for managing and sharing Docker container images, including FIWARE services, known as generic enablers GE (http://catalogue.fiware.org/enablers);

• Docker Engine: creates and runs Docker containers;

• Docker Compose: defines multi-container applications;.

• Docker Machine: creates and manages Docker hosts locally or on cloud providers (including OpenStack). It can be used to create and manage Docker swam clusters.

• Docker Swarm: manages a pool of Docker hosts using the full suite of Docker tools. Because Docker Swarm serves the standard Docker API, any tool that already communicates with a Docker daemon, e.g. Docker-Compose, can use Swarm to transparently scale to multiple hosts.

• FIWARE Lab Docker Hosting: Docker machines, Docker Swarm clusters, and Docker containers can be hosted on the FIWARE lab, but remotely created and managed by local Docker clients;

3

Page 4: Simple docker hosting on fiware lab

Simple Docker hosting on FIWARE Remotely Managed by Docker Client

……

Node

….

Node

….

client

client

docker-enginedocker-machinedocker-composedocker-swarm

docker api

any tool basedon

docker-apidocker cli

Page 5: Simple docker hosting on fiware lab

Set up steps

1. Sign up fiware account (https://account.lab.fiware.org/sign_up/)

2. (Optionall) Request Community Upgrade

3. The orgranization automatically associated with your account must be able to allocateat least on floating point IP and access at least one FIWARE region. You can create other organizations.

4. In Cloud service

– Create Security Group that exposes ports for daemon, ssh, and any other ports that are required.

– Allocated a floating point IP

5. Install docker and docker-machine on your local computer

6. Use docker-machine to create hosts on the desired FIWARE Lab regions

5

Page 6: Simple docker hosting on fiware lab
Page 7: Simple docker hosting on fiware lab
Page 8: Simple docker hosting on fiware lab

8

FIWARE Set up: Add security group for docker-machine

SSH: Port 22 Docker Daemon Port 2376Docker Swarm Master Port: 3376Auto allocated user ports: 32768-33768Other User Ports e.g. 8080

Page 9: Simple docker hosting on fiware lab

9

FIWARE set up: Allocate at least one public ip

Page 10: Simple docker hosting on fiware lab

10

FIWARE Setup: Get image ID

Page 11: Simple docker hosting on fiware lab

11

docker-machine create docker host on FIWARE

export OS_REGION_NAME=<fiware region> #e.g. 'Spain2’

export OS_TENANT_NAME=<user’s organization> #e.g. ‘username cloud’

export OS_USERNAME=<user’s email address> #e.g. ‘[email protected]

export OS_PASSWORD=<user’s password>

export OS_AUTH_URL='http://cloud.lab.fi-ware.org:4730/v2.0/'

export OS_AUTH_STRATEGY='keystone'

Page 12: Simple docker hosting on fiware lab

12

docker-machine create docker host on fiware

docker-machine create -d openstack --openstack-flavor-id="2" --openstack-image-id="e3294fcf-0598-4b3f-934e-189fa92c6990" --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-machine-sg" FIWARE-SPAIN2

Page 13: Simple docker hosting on fiware lab
Page 14: Simple docker hosting on fiware lab

14

docker-machine ls

Page 15: Simple docker hosting on fiware lab

>eval “$(docker-machine env FIWARE-SPAIN2)”

>docker info

Page 16: Simple docker hosting on fiware lab

>eval $(docker-machine env FIWARE-SPAIN2)

>docker run hello-world

Page 17: Simple docker hosting on fiware lab
Page 18: Simple docker hosting on fiware lab

>eval $(docker-machine env FIWARE-SPAIN2)

>docker-compose up –d

>docker-compose ps

curl <FIWARE-SPAIN2 IP>:<EXPOSED PORT>

>curl <FIWARE-SPAIN2 IP>:<EXPOSED PORT>

Page 19: Simple docker hosting on fiware lab
Page 20: Simple docker hosting on fiware lab

20

Docker create swarm container

Save token in $TOKEN

> docker run swarm create

Page 21: Simple docker hosting on fiware lab

21

Docker Swarm: create master

>export OS_REGION_NAME=Spain2>docker-machine create -d openstack --openstack-flavor-id="2" --openstack-image-id=$imageID --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-machine-sg" --swarm --swarm-master --swarm-discovery token://$TOKEN FIWARE-SPAIN2

Page 22: Simple docker hosting on fiware lab

22

Docker Swarm: create agent

>export OS_REGION_NAME=Crete>docker-machine create -d openstack --openstack-flavor-id="2" --openstack-image-id=$imageID --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-machine-sg" --swarm --swarm-discovery token://$TOKEN FIWARE-Crete

Page 23: Simple docker hosting on fiware lab

docker swarm

• docker-machine ls

Page 24: Simple docker hosting on fiware lab

>eval “$(docker-machine env --swarm FIWARE-SPAIN2)”

>docker info

Page 25: Simple docker hosting on fiware lab

>eval $(docker-machine env --swarm FIWARE-SPAIN2)

>docker run hello-world

>docker ps -a

Page 26: Simple docker hosting on fiware lab

>eval $(docker-machine env --swarm FIWARE-SPAIN2)

>docker-compose up -d

>docker ps

>curl http://147.27.60.99:32768/employees/resources/employees/

Page 27: Simple docker hosting on fiware lab

>eval $(docker-machine env --swarm FIWARE-SPAIN2)

>docker-compose stop

>docker-compose ps

Page 28: Simple docker hosting on fiware lab

Limitations

•labor-intensive for non-trivial environments•security•multi-tenancy•scalability•manageability•limited Docker features (storage, network, etc)•not production-ready (high availability, etc)

Page 29: Simple docker hosting on fiware lab