Class: Docker::Postgres

Inherits:
Container show all
Defined in:
lib/docker/postgres.rb

Instance Attribute Summary

Attributes inherited from Container

#id, #removal_instructions

Class Method Summary collapse

Methods inherited from Container

#add_removal_instructions, #attach!, #disable!, #exists_in?, #from_a?, #from_klass, #initialize, #inspekt, #ip, load_from, #logs, #method_missing, #path, #remove!, #removed?, #to_klass, #up?

Methods included from Equality

#==

Constructor Details

This class inherits a constructor from Docker::Container

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Docker::Container

Class Method Details

.run(name, version = '9.3.5') ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/docker/postgres.rb', line 4

def self.run(name, version = '9.3.5')
  pg = Docker.find_container(name: name)
  if pg
    pg.start! if pg.stopped? 
  else
    pg = super("postgres:#{version}", "-d --name #{name}")
    sleep 3
  end
  pg
end