Class: EacDocker::Container
- Inherits:
-
Object
- Object
- EacDocker::Container
show all
- Defined in:
- lib/eac_docker/container.rb,
lib/eac_docker/container/exist.rb,
lib/eac_docker/container/identifiers.rb,
lib/eac_docker/container/run_command.rb,
lib/eac_docker/container/start_command.rb
Defined Under Namespace
Modules: Identifiers
Classes: Exist, RunCommand, StartCommand
Instance Method Summary
collapse
Instance Method Details
#hostname ⇒ Object
18
19
20
21
22
23
|
# File 'lib/eac_docker/container.rb', line 18
def hostname
::EacDocker::Executables.docker.command(
'inspect', '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
id
).execute!.strip
end
|
#immutable_constructor_args ⇒ Object
12
13
14
|
# File 'lib/eac_docker/container.rb', line 12
def immutable_constructor_args
[image]
end
|
#immutable_volume ⇒ Object
16
|
# File 'lib/eac_docker/container.rb', line 16
alias immutable_volume volume
|
#on_detached ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/eac_docker/container.rb', line 30
def on_detached
self.id = run_command(%w[--detach]).execute!.strip
begin
yield(self)
ensure
stop
end
end
|
#remove_command ⇒ String
Force removal of the container identified by #id, if present, or #name.
46
47
48
|
# File 'lib/eac_docker/container.rb', line 46
def remove_command
::EacDocker::Executables.docker.command('rm', '--force', identifier)
end
|
#volume(left_part, right_part = nil) ⇒ Object
39
40
41
|
# File 'lib/eac_docker/container.rb', line 39
def volume(left_part, right_part = nil)
immutable_volume(right_part.if_present(left_part) { |v| "#{left_part}:#{v}" })
end
|