network_disconnect.go 482 B

123456789101112131415
  1. package client
  2. import (
  3. "github.com/docker/engine-api/types"
  4. "golang.org/x/net/context"
  5. )
  6. // NetworkDisconnect disconnects a container from an existent network in the docker host.
  7. func (cli *Client) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error {
  8. nd := types.NetworkDisconnect{Container: containerID, Force: force}
  9. resp, err := cli.post(ctx, "/networks/"+networkID+"/disconnect", nil, nd, nil)
  10. ensureReaderClosed(resp)
  11. return err
  12. }