src/Joli/JoliCi/ServiceManager.php
public function stop(Job $job, $timeout = 10)
    {
        foreach ($job->getServices() as $service) {
            if ($service->getContainer()) {
                try {
                    $this->docker->getContainerManager()->stop($service->getContainer(), [
                        't' => $timeout
                    ]);
                } catch (ClientErrorException $e) {
                    if ($e->getResponse()->getStatusCode() != 304) {
                        throw $e;
                    }
                }

                $this->docker->getContainerManager()->remove($service->getContainer(), [
                    'v' => true,
                    'force' => true
                ]);

                $service->setContainer(null);
            }
        }
    }
public function stop(Job $job, $timeout = 10)
    {
        foreach ($job->getServices() as $service) {
            if ($service->getContainer()) {
                try {
                    $this->docker->getContainerManager()->stop($service->getContainer(), [
                        't' => $timeout
                    ]);
                } catch (ClientErrorException $e) {
                    if ($e->getResponse()->getStatusCode() != 304) {
                        throw $e;
                    }
                }

                $this->docker->getContainerManager()->remove($service->getContainer(), [
                    'v' => true,
                    'force' => true
                ]);

                $service->setContainer(null);
            }
        }
    }
Stop services for a Job and reinit volumes

@param Job $job     The job to stop services
@param int $timeout Timeout to wait before killing the service