Add basic docker driver methods for `docker network` subcommand

This commit is contained in:
Brian Cain 2019-02-25 15:25:22 -08:00
parent b4d87e6ce9
commit ec2e0380ee
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 43 additions and 0 deletions

View File

@ -177,6 +177,49 @@ module VagrantPlugins
end
end
# @param[String] network - name of network to connect conatiner to
# @param[String] cid - container id
# @param[Array] opts - An array of flags used for listing networks
def connect_network(network, cid, opts=nil)
output = execute('docker', 'network', 'connect', network, cid, opts)
end
# @param[String] network - name of network to create
# @param[Array] opts - An array of flags used for listing networks
def create_network(network, opts=nil)
output = execute('docker', 'network', 'create', network, opts)
end
# @param[String] network - name of network to disconnect container from
# @param[String] cid - container id
# @param[Array] opts - An array of flags used for listing networks
def disconnect_network(network, cid, opts=nil)
output = execute('docker', 'network', 'disconnect', network, cid, opts)
end
# @param[Array] networks - list of networks to inspect
# @param[Array] opts - An array of flags used for listing networks
def inspect_network(networks, opts=nil)
output = execute('docker', 'network', 'inspect', networks, opts)
end
# @param[Array] opts - An array of flags used for listing networks
def list_network(opts=nil)
output = execute('docker', 'network', 'ls', opts)
end
# @param[Array] opts - An array of flags used for listing networks
def prune_network(opts)
output = execute('docker', 'network', 'prune', '--force', opts)
end
# @param[String] network - name of network to remove
# @param[Array] opts - An array of flags used for listing networks
def rm_network(networks, opts)
output = execute('docker', 'network', 'rm', network, opts)
end
# @param[Array] opts - An array of flags used for listing networks
def execute(*cmd, **opts, &block)
@executor.execute(*cmd, **opts, &block)
end