private void stopContainerQuietly(final String image, final String idOrName) {
        final long startTime = System.currentTimeMillis();
        try {
            LOGGER.info("Killing docker container {} with id {}", image, idOrName);
            final int secondsToWaitBeforeKilling = 10;
            client.stopContainer(containerId, secondsToWaitBeforeKilling);
        } catch (DockerException | InterruptedException e) {
            // log error and ignore exception
            LOGGER.warn("Unable to kill docker container {} with id", image, idOrName, e);
        } finally {
            final long elapsedMillis = System.currentTimeMillis() - startTime;
            LOGGER.info("Docker container {} with id {} killed in {}ms", image, idOrName, elapsedMillis);
        }
    }
private void stopContainerQuietly ( final String image , final String idOrName ) { final long startTime = System . currentTimeMillis ( ) ; try { LOGGER . info ( "Killing docker container {} with id {}" , image , idOrName ) ; final int secondsToWaitBeforeKilling = 10 ; client . stopContainer ( containerId , secondsToWaitBeforeKilling ) ; } catch ( DockerException | InterruptedException e ) { LOGGER . warn ( "Unable to kill docker container {} with id" , image , idOrName , e ) ; } finally { final long elapsedMillis = System . currentTimeMillis ( ) - startTime ; LOGGER . info ( "Docker container {} with id {} killed in {}ms" , image , idOrName , elapsedMillis ) ; } }
Utility method to stop a container with the given image name and id/name.

@param image
image name
@param idOrName
container id or name