當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Backend.UpdateContainerServiceConfig方法代碼示例

本文整理匯總了Golang中github.com/docker/docker/daemon/cluster/executor.Backend.UpdateContainerServiceConfig方法的典型用法代碼示例。如果您正苦於以下問題:Golang Backend.UpdateContainerServiceConfig方法的具體用法?Golang Backend.UpdateContainerServiceConfig怎麽用?Golang Backend.UpdateContainerServiceConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/docker/docker/daemon/cluster/executor.Backend的用法示例。


在下文中一共展示了Backend.UpdateContainerServiceConfig方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: create

func (c *containerAdapter) create(ctx context.Context, backend executorpkg.Backend) error {
	var cr types.ContainerCreateResponse
	var err error
	version := httputils.VersionFromContext(ctx)
	validateHostname := versions.GreaterThanOrEqualTo(version, "1.24")

	if cr, err = backend.CreateManagedContainer(types.ContainerCreateConfig{
		Name:       c.container.name(),
		Config:     c.container.config(),
		HostConfig: c.container.hostConfig(),
		// Use the first network in container create
		NetworkingConfig: c.container.createNetworkingConfig(),
	}, validateHostname); err != nil {
		return err
	}

	// Docker daemon currently doesn't support multiple networks in container create
	// Connect to all other networks
	nc := c.container.connectNetworkingConfig()

	if nc != nil {
		for n, ep := range nc.EndpointsConfig {
			if err := backend.ConnectContainerToNetwork(cr.ID, n, ep); err != nil {
				return err
			}
		}
	}

	if err := backend.UpdateContainerServiceConfig(cr.ID, c.container.serviceConfig()); err != nil {
		return err
	}

	return nil
}
開發者ID:Raphaeljunior,項目名稱:docker,代碼行數:34,代碼來源:adapter.go

示例2: create

func (c *containerAdapter) create(ctx context.Context, backend executorpkg.Backend) error {
	var cr types.ContainerCreateResponse
	var err error
	if cr, err = backend.CreateManagedContainer(types.ContainerCreateConfig{
		Name:       c.container.name(),
		Config:     c.container.config(),
		HostConfig: c.container.hostConfig(),
		// Use the first network in container create
		NetworkingConfig: c.container.createNetworkingConfig(),
	}); err != nil {
		return err
	}

	// Docker daemon currently doesnt support multiple networks in container create
	// Connect to all other networks
	nc := c.container.connectNetworkingConfig()

	if nc != nil {
		for n, ep := range nc.EndpointsConfig {
			logrus.Errorf("CONNECT %s : %v", n, ep.IPAMConfig.IPv4Address)
			if err := backend.ConnectContainerToNetwork(cr.ID, n, ep); err != nil {
				return err
			}
		}
	}

	if err := backend.UpdateContainerServiceConfig(cr.ID, c.container.serviceConfig()); err != nil {
		return err
	}

	return nil
}
開發者ID:amitshukla,項目名稱:docker,代碼行數:32,代碼來源:adapter.go


注:本文中的github.com/docker/docker/daemon/cluster/executor.Backend.UpdateContainerServiceConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。