Class: DockerSwarm::Container

Inherits:
Base
  • Object
show all
Includes:
DockerSwarm::Concerns::Deletable, DockerSwarm::Concerns::Loggable
Defined in:
lib/docker_swarm/models/container.rb

Overview

Represents a Docker Container

Instance Method Summary collapse

Methods included from DockerSwarm::Concerns::Loggable

#logs

Methods included from DockerSwarm::Concerns::Deletable

#destroy

Methods inherited from Base

all, #as_json, #assign_attributes, #attributes, defined_attributes, find, #id, #initialize, #method_missing, #payload_for_docker, #persisted?, #reload, resource_name, #respond_to_missing?, root_key, routes, #serializable_hash, where

Methods included from DockerSwarm::Concerns::Inspectable

#inspect

Constructor Details

This class inherits a constructor from DockerSwarm::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DockerSwarm::Base

Instance Method Details

#startBoolean

Starts the container

Returns:

  • (Boolean)

    true if successful



12
13
14
15
# File 'lib/docker_swarm/models/container.rb', line 12

def start
  Api.request(action: self.class.routes[:start], arguments: { id: self.ID })
  true
end

#stopBoolean

Stops the container

Returns:

  • (Boolean)

    true if successful



19
20
21
22
# File 'lib/docker_swarm/models/container.rb', line 19

def stop
  Api.request(action: self.class.routes[:stop], arguments: { id: self.ID })
  true
end