Interface DockerAPI
public interface DockerAPI
Interface to the Docker API.
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe docker output stream format.static final intThe number of bytes in the log header that are unused.
- 
Method SummaryModifier and TypeMethodDescriptioncreate(DockerCreateRequest request) Create a new Docker container.static DockerAPIcreateClient(String url) Get a client for the API.voidDelete a Docker container.byte[]Get the raw logs of the container.Get the state of a container.static StringreadLog(byte[] data) Read docker log raw format.voidStart a Docker container.voidwait(String id, DockerAPI.WaitCondition condition) Wait for a Docker container to exit.
- 
Field Details- 
APPLICATION_VND_DOCKER_RAW_STREAMThe docker output stream format.- See Also:
 
- 
HEADER_UNUSED_BYTESstatic final int HEADER_UNUSED_BYTESThe number of bytes in the log header that are unused.- See Also:
 
 
- 
- 
Method Details- 
create@Produces("application/json") @Consumes("application/json") @POST @Path("/containers/create") DockerCreateResponse create(DockerCreateRequest request) Create a new Docker container.- Parameters:
- request- The details of the container to create.
- Returns:
- The response to the container creation request.
 
- 
startStart a Docker container.- Parameters:
- id- The identifier of the container.
 
- 
inspect@GET @Produces("application/json") @Path("/containers/{id}/json") DockerInspectResponse inspect(@PathParam("id") String id) Get the state of a container.- Parameters:
- id- The identifier of the container.
- Returns:
- The state description.
 
- 
wait@POST @Path("/containers/{id}/wait") void wait(@PathParam("id") String id, @QueryParam("condition") DockerAPI.WaitCondition condition) Wait for a Docker container to exit.- Parameters:
- id- The identifier of the container.
- condition- What we are waiting for.
 
- 
deleteDelete a Docker container.- Parameters:
- id- The identifier of the container.
 
- 
getLog@Produces("application/vnd.docker.raw-stream") @GET @Path("/containers/{id}/logs") byte[] getLog(@PathParam("id") String id, @QueryParam("stdout") boolean stdout, @QueryParam("stderr") boolean stderr) Get the raw logs of the container.- Parameters:
- id- The identifier of the container.
- stdout- True if STDOUT should be read.
- stderr- True if STDERR should be read.
- Returns:
- The raw data stream. See readLog(byte[])for how this is read.
 
- 
createClientGet a client for the API.- Parameters:
- url- The URL to connect to.
- Returns:
- A proxy of the API.
 
- 
readLogRead docker log raw format.- Parameters:
- data- The data returned by- getLog(java.lang.String, boolean, boolean).
- Returns:
- A decoded String containing all data in order received.
- Throws:
- IOException- If an error occurs when reading the log.
 
 
-