当前位置: 首页>>代码示例>>Golang>>正文


Golang drivers.MustBeRunning函数代码示例

本文整理汇总了Golang中github.com/docker/machine/libmachine/drivers.MustBeRunning函数的典型用法代码示例。如果您正苦于以下问题:Golang MustBeRunning函数的具体用法?Golang MustBeRunning怎么用?Golang MustBeRunning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MustBeRunning函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetURL

func (d *Driver) GetURL() (string, error) {
	if err := drivers.MustBeRunning(d); err != nil {
		return "", err
	}

	return fmt.Sprintf("tcp://%s", net.JoinHostPort(d.PublicIP, strconv.Itoa(d.DockerPort))), nil
}
开发者ID:RaulKite,项目名称:machine,代码行数:7,代码来源:vcloudair.go

示例2: GetURL

func (d *Driver) GetURL() (string, error) {
	if err := drivers.MustBeRunning(d); err != nil {
		return "", err
	}

	url := fmt.Sprintf("tcp://%s:%v", d.getHostname(), d.DockerPort)
	return url, nil
}
开发者ID:robertjustjones,项目名称:machine,代码行数:8,代码来源:azure.go

示例3: GetURL

func (d *Driver) GetURL() (string, error) {
	if err := drivers.MustBeRunning(d); err != nil {
		return "", err
	}

	ip, err := d.GetIP()
	if err != nil {
		return "", err
	}

	return fmt.Sprintf("tcp://%s", net.JoinHostPort(ip, "2376")), nil
}
开发者ID:RaulKite,项目名称:machine,代码行数:12,代码来源:exoscale.go

示例4: GetURL

func (d *Driver) GetURL() (string, error) {
	if err := drivers.MustBeRunning(d); err != nil {
		return "", err
	}

	ip, err := d.GetIP()
	if err != nil {
		return "", err
	}
	if ip == "" {
		return "", nil
	}

	return fmt.Sprintf("tcp://%s", net.JoinHostPort(ip, strconv.Itoa(dockerPort))), nil
}
开发者ID:robertjustjones,项目名称:machine,代码行数:15,代码来源:amazonec2.go

示例5: GetURL

func (d *Driver) GetURL() (string, error) {
	if err := drivers.MustBeRunning(d); err != nil {
		return "", err
	}

	ip, err := d.GetIP()
	if err != nil {
		return "", err
	}
	if ip == "" {
		return "", nil
	}

	return "tcp://" + net.JoinHostPort(ip, "2376"), nil
}
开发者ID:RaulKite,项目名称:machine,代码行数:15,代码来源:driver.go

示例6: GetURL

// GetURL returns a socket address to connect to Docker engine of the machine
// instance.
func (d *Driver) GetURL() (string, error) {
	if err := drivers.MustBeRunning(d); err != nil {
		return "", err
	}

	// NOTE (ahmetalpbalkan) I noticed that this is not used until machine is
	// actually created and provisioned. By then GetIP() should be returning
	// a non-empty IP address as the VM is already allocated and connected to.
	ip, err := d.GetIP()
	if err != nil {
		return "", err
	}
	u := (&url.URL{
		Scheme: "tcp",
		Host:   net.JoinHostPort(ip, fmt.Sprintf("%d", d.DockerPort)),
	}).String()
	log.Debugf("Machine URL is resolved to: %s", u)
	return u, nil
}
开发者ID:bgokden,项目名称:machine,代码行数:21,代码来源:azure.go


注:本文中的github.com/docker/machine/libmachine/drivers.MustBeRunning函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。