Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Simple docker hosting on fiware lab

1,150 views

Published on

This tutorial will explain how you can easily setup your Docker environment to develop and deploy your services on the FIWARE Lab. One of the key take-aways of this tutorial is not only can you host and manage docker on FIWARE, but you can do this remotely from your local Docker client.

Simple docker hosting on fiware lab

  1. 1. Simple Docker hosting on FIWARE Lab Kenneth Nagin IBM Cloud Chapter Lead, FIWARE nagin@il.ibm.com
  2. 2. FIWARE Lab Cloud Docker Hosting Overview • Docker Hub: cloud service for managing and sharing Docker container images, including FIWARE services, i.e. Generic Enablers (GEs) (http://catalogue.fiware.org/enablers); • Docker Engine: creates and runs Docker containers; pulls/pushes images from/to Docker Hub; • Docker Compose: defines and runs multi-container applications;. • 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. • 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. • FIWARE Lab Docker Hosting: Docker Containers, Docker machines, and Docker Swarm clusters can be hosted on the FIWARE lab, but remotely created and managed by local Docker clients; 5
  3. 3. Simple Docker hosting on FIWARE Remotely Managed by Docker Client …… Region …. Region …. client client docker-engine docker-machine docker-compose docker-swarm docker api, openstack api, ssh any tool based on docker-apidocker cli
  4. 4. 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 allocate at 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 & swarm clusters on the desired FIWARE regions 7
  5. 5. 10 FIWARE Set up: Add security group for docker-machine SSH: Port 22 Docker Daemon Port 2376 Docker Swarm Master Port: 3376 Auto allocated user ports: 32768- 33768 Other User Ports e.g. 8080
  6. 6. 11 FIWARE set up: Allocate at least one public ip
  7. 7. 12 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. ‘username@gmail.com’ export OS_PASSWORD=<user’s password> Export OS_DOMAIN_NAME=‘default’ export OS_AUTH_URL='http://cloud.lab.fi-ware.org:4730/v2.0/' export OS_AUTH_STRATEGY='keystone'
  8. 8. 13 docker-machine create docker host on fiware $ docker-machine create -d openstack --openstack-flavor-id="2“ --openstack-image-name=“base_Ubuntu_14.04” --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-machine-sg" --openstack-ssh-user=“ubuntu” FIWARE-SPAIN2 Don’t forget to configure the security group with all necessary ports.
  9. 9. 15 docker-machine ls
  10. 10. >eval “$(docker-machine env FIWARE-SPAIN2)” >docker info
  11. 11. >eval $(docker-machine env FIWARE-SPAIN2) >docker run hello-world
  12. 12. >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>
  13. 13. 21 Docker create swarm container Save token in $TOKEN > docker
  14. 14. 22 Docker Swarm: create master >export OS_REGION_NAME=Spain2 >docker-machine create -d openstack --openstack-flavor-id="2" --openstack-image-id=“base_Ubuntu_14.4” --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01“ --openstack-sec-groups="docker-machine-sg" --openstack-ssh-user=“ubuntu” --swarm --swarm-master --swarm-discovery token://$TOKEN FIWARE-SPAIN2
  15. 15. 23 Docker Swarm: create agent >export OS_REGION_NAME=Crete >docker-machine create -d openstack –-openstack-flavor-id="2" --openstack-image-id=“base_Ubuntu_14.4” --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-machine-sg“ --openstack-ssh-user=“ubuntu” --swarm --swarm-discovery token://$TOKEN FIWARE-Crete
  16. 16. docker swarm • docker-machine ls
  17. 17. >eval “$(docker-machine env --swarm FIWARE-SPAIN2)” >docker info
  18. 18. >eval $(docker-machine env --swarm FIWARE-SPAIN2) >docker run hello-world >docker ps -a
  19. 19. >eval $(docker-machine env --swarm FIWARE-SPAIN2) >docker-compose up -d >docker ps >curl http://147.27.60.99:32768/employees/resources/employees/
  20. 20. >eval $(docker-machine env --swarm FIWARE-SPAIN2) >docker-compose stop >docker-compose ps
  21. 21. Limitations •labor-intensive for non-trivial environments •security •multi-tenancy •scalability •manageability •limited Docker features (storage, network, etc) •not production-ready (high availability, etc)

×