Class: Avm::Docker::Container
- Inherits:
-
Object
- Object
- Avm::Docker::Container
- Defined in:
- lib/avm/docker/container.rb
Instance Method Summary collapse
- #remove ⇒ Object
- #run(options = {}) ⇒ Object
- #run_run(options) ⇒ Object
- #run_run_arguments(options) ⇒ Object
- #run_start ⇒ Object
- #run_start_arguments ⇒ Object
Instance Method Details
#remove ⇒ Object
12 13 14 15 16 |
# File 'lib/avm/docker/container.rb', line 12 def remove ::EacDocker::Executables.docker.command.append( ['rm', '--force', instance.docker_container_name] ).system! end |
#run(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/avm/docker/container.rb', line 18 def run( = {}) infov 'Container name', instance.docker_container_name infov 'Container exist?', instance.docker_container_exist? remove if [:clear] && instance.docker_container_exist? if instance.docker_container_exist? run_start else run_run() end end |
#run_run(options) ⇒ Object
29 30 31 32 |
# File 'lib/avm/docker/container.rb', line 29 def run_run() infom "\"docker run #{instance.docker_container_name}...\"" ::EacDocker::Executables.docker.command.append(run_run_arguments()).system! end |
#run_run_arguments(options) ⇒ Object
39 40 41 42 43 |
# File 'lib/avm/docker/container.rb', line 39 def run_run_arguments() entrypoint_args = [:entrypoint_args].if_present([]) ['run', '-it', '--name', instance.docker_container_name] + instance.docker_run_arguments + [instance.docker_image.tag] + entrypoint_args end |
#run_start ⇒ Object
34 35 36 37 |
# File 'lib/avm/docker/container.rb', line 34 def run_start infom "\"docker start #{instance.docker_container_name}...\"" ::EacDocker::Executables.docker.command.append(run_start_arguments).system! end |
#run_start_arguments ⇒ Object
45 46 47 |
# File 'lib/avm/docker/container.rb', line 45 def run_start_arguments ['start', '-ai', instance.docker_container_name] end |