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


Golang HostConfig.DNS方法代码示例

本文整理汇总了Golang中github.com/docker/engine-api/types/container.HostConfig.DNS方法的典型用法代码示例。如果您正苦于以下问题:Golang HostConfig.DNS方法的具体用法?Golang HostConfig.DNS怎么用?Golang HostConfig.DNS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/docker/engine-api/types/container.HostConfig的用法示例。


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

示例1: updateHostConfig

// These two functions are OS specific (for now at least)
func updateHostConfig(hc *dockercontainer.HostConfig, opts *kubecontainer.RunContainerOptions) {
	// There is no /etc/resolv.conf in Windows, DNS and DNSSearch options would have to be passed to Docker runtime instead
	hc.DNS = opts.DNS
	hc.DNSSearch = opts.DNSSearch

	// MemorySwap == -1 is not currently supported in Docker 1.14 on Windows
	// https://github.com/docker/docker/blob/master/daemon/daemon_windows.go#L175
	hc.Resources.MemorySwap = 0
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:10,代码来源:docker_manager_windows.go

示例2: createRoach

func (l *LocalCluster) createRoach(i int, dns, vols *Container, cmd ...string) *Container {
	l.panicOnStop()

	hostConfig := container.HostConfig{
		PublishAllPorts: true,
	}

	if dns != nil {
		ci, err := dns.Inspect()
		maybePanic(err)
		hostConfig.DNS = append(hostConfig.DNS, ci.NetworkSettings.IPAddress)
	}
	if vols != nil {
		hostConfig.VolumesFrom = append(hostConfig.VolumesFrom, vols.id)
	}

	var hostname string
	if i >= 0 {
		hostname = fmt.Sprintf("roach%d", i)
	}
	var entrypoint []string
	if *cockroachImage == builderImage {
		entrypoint = append(entrypoint, "/"+filepath.Base(*cockroachBinary))
	} else if *cockroachEntry != "" {
		entrypoint = append(entrypoint, *cockroachEntry)
	}
	c, err := createContainer(
		l,
		container.Config{
			Hostname:   hostname,
			Domainname: domain,
			Image:      *cockroachImage,
			ExposedPorts: map[nat.Port]struct{}{
				cockroachTCP: {},
				pgTCP:        {},
			},
			Entrypoint: strslice.New(entrypoint...),
			Cmd:        strslice.New(cmd...),
			Labels: map[string]string{
				// Allow for `docker ps --filter label=Hostname=roach0` or `--filter label=Roach`.
				"Hostname": hostname,
				"Roach":    "",
			},
		},
		hostConfig,
		nodeStr(i),
	)
	maybePanic(err)
	return c
}
开发者ID:duguruiyuan,项目名称:cockroach,代码行数:50,代码来源:localcluster.go


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