Sha256: baf483718c4578652042a40fd09eb55be7bca9a200a0b35627d51ce2b346f760
Contents?: true
Size: 976 Bytes
Versions: 3
Compression:
Stored size: 976 Bytes
Contents
module Rascal module Docker class Network def initialize(name) @name = name @prefixed_name = "#{NAME_PREFIX}#{name}" end def create Docker.interface.run( 'network', 'create', @prefixed_name, ) end def disconnect(container_id) Docker.interface.run( 'network', 'disconnect', id, container_id, ) rescue Interface::Error => e raise unless e.message.include?('is not connected') end def exists? !!id end def clean if exists? Docker.interface.run( 'network', 'rm', id, ) end end def id @id ||= Docker.interface.run( 'network', 'ls', '--quiet', '--filter', "name=^#{@prefixed_name}$", output: :id, ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rascal-0.3.7 | lib/rascal/docker/network.rb |
rascal-0.3.6 | lib/rascal/docker/network.rb |
rascal-0.3.5 | lib/rascal/docker/network.rb |