コード例 #1
0
// ConnectToDockerEnvNetwork connects the provided container ID to the network
// bridge of an environment and returns the IPv4 of the container within that
// network.
func ConnectToDockerEnvNetwork(
	docker *dockerapi.Client, containerID, networkID string) (
	containerIPv4 string, err error) {
	err = docker.ConnectNetwork(
		networkID, dockerapi.NetworkConnectionOptions{Container: containerID})
	if err != nil {
		return "", err
	}

	return GetDockerEnvIPv4(docker, containerID, networkID)
}