// createContainer creates a new container using the specified // options. Per the docker API, the created container is not running // and must be started explicitly. Note that the passed-in hostConfig // will be augmented with the necessary settings to use the network // defined by l.createNetwork(). func createContainer( l *LocalCluster, containerConfig container.Config, hostConfig container.HostConfig, containerName string, ) (*Container, error) { hostConfig.NetworkMode = container.NetworkMode(l.networkID) // Disable DNS search under the host machine's domain. This can // catch upstream wildcard DNS matching and result in odd behavior. hostConfig.DNSSearch = []string{"."} resp, err := l.client.ContainerCreate(context.Background(), &containerConfig, &hostConfig, nil, containerName) if err != nil { return nil, err } return &Container{ id: resp.ID, name: containerName, cluster: l, }, nil }