Content
• Overview
• Basic Set Up
• Docker Engine
• Docker Compose
• Docker Machine
• Docker Swarm
• limitations
2
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
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
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
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
9
FIWARE set up: Allocate at least one public ip
10
FIWARE Setup: Get image ID
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'
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
14
docker-machine ls
>eval “$(docker-machine env FIWARE-SPAIN2)”
>docker info
>eval $(docker-machine env FIWARE-SPAIN2)
>docker run hello-world
>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>
20
Docker create swarm container
Save token in $TOKEN
> docker run swarm create
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
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
docker swarm
• docker-machine ls
>eval “$(docker-machine env --swarm FIWARE-SPAIN2)”
>docker info
>eval $(docker-machine env --swarm FIWARE-SPAIN2)
>docker run hello-world
>docker ps -a
>eval $(docker-machine env --swarm FIWARE-SPAIN2)
>docker-compose up -d
>docker ps
>curl http://147.27.60.99:32768/employees/resources/employees/
>eval $(docker-machine env --swarm FIWARE-SPAIN2)
>docker-compose stop
>docker-compose ps
Limitations
•labor-intensive for non-trivial environments•security•multi-tenancy•scalability•manageability•limited Docker features (storage, network, etc)•not production-ready (high availability, etc)