why it’s so magic? - apache software...
TRANSCRIPT
Nguyen Anh Tu Apache CloudStack committer
@ngtuna11 ngtuna.blogspot.com
An implementation
Agenda • Docker – why it’s so magic? • Docker in OpenStack • What should I do with CloudStack ? • Docker with PaaS - an example from Apache Stratos
Why it’s so magic?
• client.py – Docker client – API version 1.4 – list, create, start, stop container – get, inspect image – pull, push repository
• driver.py – Docker Virt driver – provisioning, snapshot instances – setup network – monitoring host capacity
• hostinfo.py – host capacity – memory usage – disk usage
A look inside
Docker Resource
Agent Manager
Docker
Container A
Container B
Virtual Router
Docker-registry
agent.properties: hypervisor.type = docker resource = com.cloud.hypervisor.docker.resource.DockerResource
HTTP API
Cmd
Three ways to register template • From a repository image • From a dockerfile • From a tar file
Docker hypervisor
Pipework
Virtual Router
• Spawn container in network-less mode
• CloudStack IP address allocator • Network services from Virual Router
container • Pipework
• pipework br1 $VIRTUALROUTER 10.1.1.1/24 • pipework br1 $CONTAINER 10.1.1.2/24
Network orchestration
https://github.com/jpetazzo/pipework
Docker HTTP request • Docker server: /bin/bash –c docker –H <ipaddr>:5555 –d & • Docker client:
String url = System.getProperty("docker.url", "http://<ipaddr>:5555"); dockerClient = new DockerClient(url);
• Images: list, inspect, pull, commit, search ClientResponse response = dockerClient.pull(testImage);
• Containers: list, create, start, stop, remove ContainerCreateResponse container = dockerClient.createContainer(containerConfig);
• Build from Dockerfile File baseDir = new File(Thread.currentThread().getContextClassLoader().getResource(”path/to/folder").getFile()); ClientResponse response = dockerClient.build(baseDir);
• Upload tar file InputStream tar = Thread.currentThread().getContextClassLoader().getResourceAsStream(”path/to/empty.tar"); String imageId = dockerClient.importImage("empty", null, tar).getId();
https://github.com/kpelykh/docker-java
Adding Docker hypervisor • New plugin: cloud-plugin-hypervisor-docker
– DockerResource » a docker driver
– DockerGuru » setup container parameters for spawning
– DockerServerDiscoverer » to discover and register host to Agent Manager » ton of tricks: connection checking, health checking,…
– Docker HTTP request – cloud-setup-agent
» Config services on docker host: network, nfs, security policy, firewall,… » update agent.properties » start docker agent service
– Agent, Agentshell, Agent Manager » contact to hosts » send cmd, health checking, connection checking
Apache Stratos Architecture
IaaS layer
AWS EC2 IaaS Impl
Cloud Controller
OpenStack IaaS Impl
vCloud IaaS Impl
Apache jCloud
Two ways of integration • Support IaaS providers supporting Docker hypervisor
Two ways of integration • Support Docker directly from jCloud
https://github.com/andreaturli/jclouds-labs/tree/feature/docker/docker