Search in sources :

Example 1 with StartContainerCmd

use of com.github.dockerjava.api.command.StartContainerCmd in project camel by apache.

the class DockerProducer method executeStartContainerRequest.

/**
     * Produce a start container request
     *
     * @param client
     * @param message
     * @return
     */
private StartContainerCmd executeStartContainerRequest(DockerClient client, Message message) {
    LOGGER.debug("Executing Docker Start Container Request");
    String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class);
    ObjectHelper.notNull(containerId, "Container ID must be specified");
    StartContainerCmd startContainerCmd = client.startContainerCmd(containerId);
    return startContainerCmd;
}
Also used : StartContainerCmd(com.github.dockerjava.api.command.StartContainerCmd)

Example 2 with StartContainerCmd

use of com.github.dockerjava.api.command.StartContainerCmd in project dockerunit by qzagarese.

the class DefaultServiceBuilder method startContainer.

private String startContainer(CreateContainerCmd cmd, DockerClient client) {
    CreateContainerResponse createResp = cmd.exec();
    StartContainerCmd startCmd = client.startContainerCmd(createResp.getId());
    try {
        startCmd.exec();
    } catch (Throwable t) {
        throw new ContainerException(createResp.getId(), t);
    }
    return startCmd.getContainerId();
}
Also used : ContainerException(com.github.qzagarese.dockerunit.exception.ContainerException) StartContainerCmd(com.github.dockerjava.api.command.StartContainerCmd) CreateContainerResponse(com.github.dockerjava.api.command.CreateContainerResponse)

Aggregations

StartContainerCmd (com.github.dockerjava.api.command.StartContainerCmd)2 CreateContainerResponse (com.github.dockerjava.api.command.CreateContainerResponse)1 ContainerException (com.github.qzagarese.dockerunit.exception.ContainerException)1