public void followOutput(DockerClient dockerClient, String containerId, Consumer<OutputFrame> consumer) { followOutput(dockerClient, containerId, consumer, STDOUT, STDERR); }
private void followLogs(String containerId, Consumer<OutputFrame> consumer) { LogUtils.followOutput(DockerClientFactory.instance().client(), containerId, consumer); }
/** * Follow container output, sending each frame (usually, line) to a consumer. Stdout and stderr will be followed. * * @param consumer consumer that the frames should be sent to */ default void followOutput(Consumer<OutputFrame> consumer) { LogUtils.followOutput(DockerClientFactory.instance().client(), getContainerId(), consumer); }
/** * Follow container output, sending each frame (usually, line) to a consumer. This method allows Stdout and/or stderr * to be selected. * * @param consumer consumer that the frames should be sent to * @param types types that should be followed (one or both of STDOUT, STDERR) */ default void followOutput(Consumer<OutputFrame> consumer, OutputFrame.OutputType... types) { LogUtils.followOutput(DockerClientFactory.instance().client(), getContainerId(), consumer, types); }
@Override protected void waitUntilReady() { WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(DockerClientFactory.instance().client(), waitStrategyTarget.getContainerId(), waitingConsumer); Predicate<OutputFrame> waitPredicate = outputFrame -> // (?s) enables line terminator matching (equivalent to Pattern.DOTALL) outputFrame.getUtf8String().matches("(?s)" + regEx); try { waitingConsumer.waitUntil(waitPredicate, startupTimeout.getSeconds(), TimeUnit.SECONDS, times); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out waiting for log output matching '" + regEx + "'"); } }
private void followLogs(String containerId, Consumer<OutputFrame> consumer) { LogUtils.followOutput(DockerClientFactory.instance().client(), containerId, consumer); }
/** * Follow container output, sending each frame (usually, line) to a consumer. Stdout and stderr will be followed. * * @param consumer consumer that the frames should be sent to */ default void followOutput(Consumer<OutputFrame> consumer) { LogUtils.followOutput(DockerClientFactory.instance().client(), getContainerId(), consumer); }
/** * Follow container output, sending each frame (usually, line) to a consumer. This method allows Stdout and/or stderr * to be selected. * * @param consumer consumer that the frames should be sent to * @param types types that should be followed (one or both of STDOUT, STDERR) */ default void followOutput(Consumer<OutputFrame> consumer, OutputFrame.OutputType... types) { LogUtils.followOutput(DockerClientFactory.instance().client(), getContainerId(), consumer, types); }
@Override protected void waitUntilReady() { WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(DockerClientFactory.instance().client(), waitStrategyTarget.getContainerId(), waitingConsumer); Predicate<OutputFrame> waitPredicate = outputFrame -> // (?s) enables line terminator matching (equivalent to Pattern.DOTALL) outputFrame.getUtf8String().matches("(?s)" + regEx); try { waitingConsumer.waitUntil(waitPredicate, startupTimeout.getSeconds(), TimeUnit.SECONDS, times); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out waiting for log output matching '" + regEx + "'"); } }
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("ready to serve client requests"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("ready to serve client requests"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("ready to serve client requests"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };
public static void followOutput(DockerClient dockerClient, String containerId, Consumer<OutputFrame> consumer) { followOutput(dockerClient, containerId, consumer, STDOUT, STDERR); }
@Override protected void waitUntilReady() { final DockerClient client = DockerClientFactory.instance().client(); final WaitingConsumer waitingConsumer = new WaitingConsumer(); LogUtils.followOutput(client, waitStrategyTarget.getContainerId(), waitingConsumer); try { waitingConsumer.waitUntil( f -> f.getUtf8String().contains("etcdserver: published"), startupTimeout.getSeconds(), TimeUnit.SECONDS, 1 ); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out"); } } };