mirror of
https://github.com/drone/drone-cli.git
synced 2026-02-06 10:03:36 +01:00
19 lines
578 B
Go
19 lines
578 B
Go
package docker // import "docker.io/go-docker"
|
|
|
|
import (
|
|
"docker.io/go-docker/api/types"
|
|
"docker.io/go-docker/api/types/network"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
// NetworkConnect connects a container to an existent network in the docker host.
|
|
func (cli *Client) NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error {
|
|
nc := types.NetworkConnect{
|
|
Container: containerID,
|
|
EndpointConfig: config,
|
|
}
|
|
resp, err := cli.post(ctx, "/networks/"+networkID+"/connect", nil, nc, nil)
|
|
ensureReaderClosed(resp)
|
|
return err
|
|
}
|