Running the Kestrel OSGi Runtime with Docker Machine by using aliyunecs driver plugin

本文指导您如何在OSX 10.11.1上通过Docker安装阿里云ECS驱动,配置环境变量,创建Docker机器实例,从阿里云仓库拉取并运行Kestrel容器,最终连接控制台并启动Kestrel服务。

Works on OS X - 10.11.1

Kestrel OSGi Runtime

A custom distribution from Apache's Karaf
It's a lightweight, powerful, and enterprise ready container powered by OSGi

Check the version of docker-machine

docker-machine -v
docker-machine version 0.6.0, build e27fb87

Check the current PATH environment has been includes the /usr/local/bin

Download the aliyunecs driver and copy to /usr/local/bin

cd ~
mkdir aliyunecsdriver

curl -L https://drone.io/github.com/denverdino/machine/files/driver/docker-machine-driver-aliyunecs_darwin-amd64.tgz >driver-aliyunecs.tgz && tar xzf driver-aliyunecs.tgz -C aliyunecsdriver && rm driver-aliyunecs.tgz

mv aliyunecsdriver/docker-machine-driver-aliyunecs_darwin-amd64 /usr/local/bin/docker-machine-driver-aliyunecs

Setup the Environment variables by using the account info

export ECS_ACCESS_KEY_ID=xxx
export ECS_ACCESS_KEY_SECRET=xxxxx
export ECS_INSTANCE_TYPE=ecs.s1.small
export ECS_REGION=xxxx
export ECS_SSH_PASSWORD=xxx
export MACHINE_DOCKER_INSTALL_URL=http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet

Creating a instance of Docker machine

docker-machine create --driver aliyunecs shellpays-dm1

Configuring shell

eval $(docker-machine env shellpays-dm1)

Pull the Kestrel from registry.aliyuncs.com/aves/kestrel:v4

docker pull registry.aliyuncs.com/aves/kestrel:v4

Run the kestrel as a instance of image

docker run -d -P --name kestrel_inst1 registry.aliyuncs.com/aves/kestrel:v4

Connecting the Console by using client

docker exec -it kestrel_inst1 client

console output sample

Logging in as karaf
981 [sshd-SshClient[66d2e7d9]-nio2-thread-2] WARN  _  __         _            _
| |/ /___  ___| |_ _ __ ___| |
| ' // _ \/ __| __| '__/ _ \ |
| . \  __/\__ \ |_| | |  __/ |
|_|\_\___||___/\__|_|  \___|_|

  Abacus Kestrel (4.0.0) Dynamic Modular Platform

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or 'system:shutdown' to shutdown Kestrel.

karaf@root()> list
START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version            | Name
------------------------------------------------------------------------------------
 10 | Active |  80 | 1.5.0              | OPS4J Base - Lang
 11 | Active |  80 | 1.5.0              | OPS4J Base - Service Provider Access
 12 | Active |  80 | 0.7.0              | OPS4J Pax JDBC Generic Driver Extender
 13 | Active |  80 | 0.7.0              | OPS4J Pax JDBC Config
 14 | Active |  80 | 1.8.1              | OPS4J Pax Swissbox :: OSGi Core
 15 | Active |  80 | 1.8.1              | OPS4J Pax Swissbox :: Extender
 16 | Active |  80 | 1.8.1              | OPS4J Pax Swissbox :: Lifecycle
 17 | Active |  80 | 1.0.0.201505202023 | org.osgi:org.osgi.service.jdbc
 18 | Active |  60 | 1.53               | bcprov
 19 | Active |  60 | 1.53               | bcprov-ext
 21 | Active |  60 | 5.1.37             | Oracle Corporation's JDBC Driver for MySQL
 23 | Active |  60 | 3.1.4              | Java UUID Generator
 25 | Active |  50 | 1.4.7              | JavaMail API (compat)
 29 | Active |  60 | 2.9.1              | Joda-Time
 49 | Active |  50 | 2.16.1             | camel-blueprint
 50 | Active |  50 | 2.16.1             | camel-catalog
 51 | Active |  80 | 2.16.1             | camel-commands-core
 52 | Active |  50 | 2.16.1             | camel-core
 53 | Active |  50 | 2.16.1             | camel-http-common

Show the runtime info

karaf@root()> shell:info
Karaf
  Karaf version               4.0.4
  Karaf home                  /usr/local/apache-karaf-4.0.4
  Karaf base                  /usr/local/apache-karaf-4.0.4
  OSGi Framework              org.apache.felix.framework-5.4.0

JVM
  Java Virtual Machine        xxx
  Version                     1.8.0xx
  Vendor                      xx
  Pid                         52
  Uptime                      4 minutes
  Total compile time          47.286 seconds
Threads
  Live threads                65
  Daemon threads              47
  Peak                        68
  Total started               101
Memory
  Current heap size           129,023 kbytes
  Maximum heap size           1,048,576 kbytes
  Committed heap size         1,048,576 kbytes
  Pending objects             0
  Garbage collector           Name = 'G1 Young Generation', Collections = 14, Time = 4.301 seconds
  Garbage collector           Name = 'G1 Old Generation', Collections = 0, Time = 0.000 seconds
Classes
  Current classes loaded      7,695
  Total classes loaded        7,695
  Total classes unloaded      0
Operating system
  Name                        Linux version 3.13.0-32-generic
  Architecture                amd64
  Processors                  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值