當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。