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.

Docker hosting on FIWARE Lab

879 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.
video version: https://www.youtube.com/watch?v=XlNI1YyQ8x8.

Published in: Software
  • Be the first to comment

Docker hosting on FIWARE Lab

  1. 1. Docker hosting on FIWARE Lab Remote management with local docker client Kenneth Nagin IBM Cloud Chapter Lead, FIWARE nagin@il.ibm.com
  2. 2. 5 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;
  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. 7 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 – Allocate a floating point IP – Create Security Group that exposes ports for daemon, ssh, and any other ports that are required. 5. Install docker and docker machine on your local computer 6. Use docker-machine to create hosts & swarm clusters on the desired FIWARE regions
  5. 5. FIWARE set up: Allocate at least one public ip
  6. 6. FIWARE set up: Create Security Group
  7. 7. FIWARE set up: Create Security Group Required: • Docker Daemon Port 2376 • SSH: Port 22 Optional: • Auto allocated user ports: 32768-33768 • Other User Ports e.g. 8080 • Docker Swarm Master Port: 3376
  8. 8. FIWARE set up: List images
  9. 9. 14 FIWARE Setup: Get image ID
  10. 10. 15 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_AUTH_URL='http://cloud.lab.fi-ware.org:4730/v2.0/' export OS_AUTH_STRATEGY='keystone'
  11. 11. 16 docker-machine create docker host on fiware docker-machine create -d openstack --openstack-flavor-id="2" --openstack-image-name="Ubuntu Server 14.04.1 (x64)" --openstack-net-name="node-int-net-01" --openstack-floatingip-pool="public-ext-net-01" --openstack-sec-groups="docker-machine-sg" docker-host
  12. 12. eval “$(docker-machine env <host name>)”
  13. 13. mongo: image: mongo:2.6 command: --smallfiles orion: image: fiware/orion links: - mongo ports: - ":1026" command: -dbhost mongo
  14. 14. 27 Docker create swarm container Save token in $TOKEN > docker run swarm create
  15. 15. 28 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
  16. 16. 29 Docker Swarm: create slave >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
  17. 17. docker swarm • docker-machine ls
  18. 18. >eval “$(docker-machine env --swarm FIWARE-SPAIN2)” >docker info
  19. 19. >eval $(docker-machine env --swarm FIWARE-SPAIN2) >docker run hello-world >docker ps -a
  20. 20. >eval $(docker-machine env --swarm FIWARE-SPAIN2) >docker-compose up -d >docker ps >curl http://147.27.60.99:32768/employees/resources/employees/
  21. 21. >eval $(docker-machine env --swarm FIWARE-SPAIN2) >docker-compose stop >docker-compose ps
  22. 22. 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

×