Stop and remove the container if it exists.
496904
def teardown(self):
        
        while self._http_clients:
            self._http_clients.pop().close()
        if self.created:
            self.halt()
80592
public function destroy()
    {
        if (
            isset($this->owner) &&
            $this->owner->_containerTrait
        ) {
            $this->owner->removeElement($this->short_name);
        }
    }
344608
def stop(self):
        
        if self._stack:
            try:
                self._stack.teardown()
            except Exception:
                self.fatal(sys.exc_info())

        super().stop()
54063
function() {
    var that = this;
    this.killed = true;
    if (this.started) {
      this.container.kill();
    } else {
      this.once('container start', function() {
        that.container.kill();
      });
    }
  }
866906
def stop(self):
        """"""
        if self._timer:
            self._timer.stop()
            self._timer.deleteLater()
1102272
def remove_existing_container(engine_obj, service_name, remove_volumes=False):
    
    conductor_container_id = engine_obj.get_container_id_for_service(service_name)
    if engine_obj.service_is_running(service_name):
        engine_obj.stop_container(conductor_container_id, forcefully=True)
    if conductor_container_id:
        engine_obj.delete_container(conductor_container_id, remove_volumes=remove_volumes)
204238
def remove_container(self, container, **kwargs):
        
        self.push_log("Removing container '{0}'.".format(container))
        set_raise_on_error(kwargs)
        super(DockerFabricClient, self).remove_container(container, **kwargs)
1301082
void stop() {
    if (!shouldRun(conf)) {
      return;
    }
    nodeHealthScriptScheduler.cancel();
    if (shexec != null) {
      Process p = shexec.getProcess();
      if (p != null) {
        p.destroy();
      }
    }
  }
1128846
def stop(self):
        
        logger.info('is being stopped', extra={'formatter': 'container', 'container': self.name})
        response = self.client.stop(self.id)

        while self.state()['running']:
            time.sleep(1)

        return response
983982
def stop(self):
        """"""
        if self.thread:
            self.running = False
            if isinstance(self.stream, ReadWriteStream):
                self.stream.write(b'\0' * self.chunk_size)
            self.thread.join()
            self.thread = None

        self.engine.stop()

        if self.pa:
            self.pa.terminate()
            self.stream.stop_stream()
            self.stream = self.pa = None
1090386
def remove_container(name, force=False):
    

    try:
        if not force:
            _get_docker().stop(name)
    except APIError:
        pass
    try:
        _get_docker().remove_container(name, force=True)
        return True
    except APIError:
        return False
1200249
def stop(self):
        
        # Exit the loop
        with self._lock:
            self._stop_event.set()
            self._shell_event.clear()

        if self._context is not None:
            # Unregister from events
            self._context.remove_service_listener(self)

            # Release the shell
            self.clear_shell()
            self._context = None
1168139
def stop(self):
        """"""

        if self.run is True and all([self.job, self.job.is_alive()]):
            print('Done.')
            self.job.terminate()
927260
function processDockerEvent(event, stop) {
    if (trackedEvents.indexOf(event.status) !== -1) {
      var container = containerById.get(event.id);
      if (container) {
        if (positiveEvents.indexOf(event.status) !== -1) {
          updateContainer(container);
        } else {
          removeContainer(container);
        }
      } else {
        // new container
        if (!stop && positiveEvents.indexOf(event.status) !== -1) {
          updateContainers(function(err) {
            if (!err) {
              processDockerEvent(event, true);
            }
          });
        }
      }
    }
  }
1089258
def stop(self):
        """"""

        for tile in self._tiles.values():
            tile.signal_stop()

        for tile in self._tiles.values():
            tile.wait_stopped()

        super(TileBasedVirtualDevice, self).stop()
201451
def stop(self):
        """"""

        try:
            yield from self._clean_servers()
            yield from self._stop_ubridge()

            try:
                state = yield from self._get_container_state()
            except DockerHttp404Error:
                self.status = "stopped"
                return

            if state == "paused":
                yield from self.unpause()

            yield from self._fix_permissions()
            state = yield from self._get_container_state()
            if state != "stopped" or state != "exited":
                # t=5 number of seconds to wait before killing the container
                try:
                    yield from self.manager.query("POST", "containers/{}/stop".format(self._cid), params={"t": 5})
                    log.info("Docker container '{name}' [{image}] stopped".format(
                        name=self._name, image=self._image))
                except DockerHttp304Error:
                    # Container is already stopped
                    pass
        # Ignore runtime error because when closing the server
        except RuntimeError as e:
            log.debug("Docker runtime error when closing: {}".format(str(e)))
            return
        self.status = "stopped"
550480
def stop(self):
        """"""
        self._stop_event.set()
        if not self.persistence:
            return
        if self._cancel_save is not None:
            self._cancel_save()
            self._cancel_save = None
        self.persistence.save_sensors()