#NEWLINE# def start( self ) : #NEWLINE# #INDENT# ' Starts a new instance of the component. Note that this does *not* update the proxy. ' #NEWLINE# client = getDockerClient ( ) #NEWLINE# self . logger . debug ( 'Starting container for component %s' , self . getName ( ) ) #NEWLINE# self . ensureImage ( client ) #NEWLINE# container = self . createContainer ( client ) #NEWLINE# report ( ( 'Starting container ' + container [ 'Id' ] [ : 12 ] ) , component = self ) #NEWLINE# if self . config . privileged : #NEWLINE# #INDENT# report ( 'Container will be run in privileged mode' , component = self ) #NEWLINE# #UNINDENT# client . start ( container , binds = self . config . getBindings ( container [ 'Id' ] ) , volumes_from = self . config . volumes_from , privileged = self . config . privileged ) #NEWLINE# report ( 'Waiting for health checks...' , component = self ) #NEWLINE# timeout = self . config . getReadyCheckTimeout ( ) #NEWLINE# readycheck_thread = Thread ( target = self . readyCheck , args = [ container , timeout ] ) #NEWLINE# readycheck_thread . daemon = True #NEWLINE# readycheck_thread . start ( ) #NEWLINE# readycheck_thread . join ( self . config . getReadyCheckTimeout ( ) ) #NEWLINE# if readycheck_thread . isAlive ( ) : #NEWLINE# #INDENT# report ( 'Timed out waiting for health checks. Stopping container...' , component = self ) #NEWLINE# client . stop ( container ) #NEWLINE# report ( 'Container stopped' , component = self ) #NEWLINE# return None #NEWLINE# #UNINDENT# setContainerComponent ( container , self . getName ( ) ) #NEWLINE# setContainerStatus ( container , 'starting' ) #NEWLINE# return container