Docker component

Table of Contents

URI format
General Options
Header Strategy
Examples
Dependencies

Available as of Camel 2.15

Camel component for communicating with Docker.

The Docker Camel component leverages the docker-java via the Docker Remote API.

URI format

docker://[operation]?[options]

Where operation is the specific action to perform on Docker.

General Options

The Docker component supports 1 options which are listed below.

{% raw %}

NameJava TypeDescription

configuration

DockerConfiguration

To use the shared docker configuration

{% endraw %}

The Docker component supports 20 endpoint options which are listed below:

{% raw %}

NameGroupDefaultJava TypeDescription

operation

common

 

DockerOperation

Required Which operation to use

email

common

 

String

Email address associated with the user

host

common

localhost

String

Required Docker host

port

common

2375

Integer

Required Docker port

requestTimeout

common

 

Integer

Request timeout for response (in seconds)

bridgeErrorHandler

consumer

false

boolean

Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.

exceptionHandler

consumer (advanced)

 

ExceptionHandler

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.

exchangePattern

consumer (advanced)

 

ExchangePattern

Sets the exchange pattern when the consumer creates an exchange.

followRedirectFilter

advanced

false

boolean

Whether to follow redirect filter

loggingFilter

advanced

false

boolean

Whether to use logging filter

maxPerRouteConnections

advanced

100

Integer

Maximum route connections

maxTotalConnections

advanced

100

Integer

Maximum total connections

serverAddress

advanced

https://index.docker.io/v1/

String

Server address for docker registry.

socket

advanced

true

boolean

Socket connection mode

synchronous

advanced

false

boolean

Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).

certPath

security

 

String

Location containing the SSL certificate chain

password

security

 

String

Password to authenticate with

secure

security

false

boolean

Use HTTPS communication

tlsVerify

security

false

boolean

Check TLS

username

security

 

String

User name to authenticate with

{% endraw %}

Header Strategy

All URI option can be passed as Header properties. Values found in a message header take precedence over URI parameters. A header property takes the form of a URI option prefixed with CamelDocker as shown below

URI OptionHeader Property

containerId

CamelDockerContainerId

Examples

The following example consumes events from Docker:

from("docker://events?host=192.168.59.103&port=2375").to("log:event");

The following example queries Docker for system wide information

from("docker://info?host=192.168.59.103&port=2375").to("log:info");

Dependencies

To use Docker in your Camel routes you need to add a dependency on camel-docker, which implements the component.

If you use Maven you can just add the following to your pom.xml, substituting the version number for the latest and greatest release (see the download page for the latest versions).

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-docker</artifactId>
  <version>x.x.x</version>
</dependency>