Docker
Since Camel 2.15
Both producer and consumer are supported
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.
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Docker component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The shared configuration of the component, which each endpoint copies and then applies its own options to. | DockerConfiguration | ||
Email address associated with the user. | String | ||
Required Docker host. In socket mode (socket=true), the path of the unix socket of the Docker daemon, where the default localhost means /var/run/docker.sock. A host with a tcp:// or unix:// scheme (such as tcp://myhost:2376 or unix:///var/run/docker.sock) is used as is, and then the port and socket options are not used. | localhost | String | |
The TCP port of the Docker daemon. Not used in socket mode, or when the host is a tcp:// or unix:// URL. | 2375 | Integer | |
The timeout in milliseconds to connect to the Docker daemon, and with JerseyDockerCmdExecFactory also to wait for data of a response. Not used with a cmdExecFactory other than NettyDockerCmdExecFactory and JerseyDockerCmdExecFactory. When not set, the defaults of the transport apply. | Integer | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
The fully qualified class name of the DockerCmdExecFactory implementation of docker-java that sends the requests to the Docker daemon, such as com.github.dockerjava.netty.NettyDockerCmdExecFactory (the default) or com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory. | com.github.dockerjava.netty.NettyDockerCmdExecFactory | String | |
Deprecated Whether to follow redirect filter. Deprecation note: Not used: nothing reads this option when the Docker client is built. | false | boolean | |
Deprecated Whether to use logging filter. Deprecation note: Not used: nothing reads this option when the Docker client is built. | false | boolean | |
Not used: the component does not pass this value to the DockerCmdExecFactory. | 100 | Integer | |
Not used: the component does not pass this value to the DockerCmdExecFactory. | 100 | Integer | |
The parameters of the endpoint URI that are not options, such as containerId=myContainer. The component sets them. Each one is the fallback for the CamelDocker header of the same name, such as containerId for CamelDockerContainerId. | Map | ||
The server address of the Docker registry. | String | ||
Socket connection mode. When enabled, connects to the unix socket of the Docker daemon, whose path is given by the host option (the default localhost means /var/run/docker.sock), and the port is not used. When disabled, connects over TCP to the host and port. | false | boolean | |
Whether to allow overriding the connection and credential settings of the endpoint with the CamelDockerHost, CamelDockerPort, CamelDockerSocketEnabled, CamelDockerSecure, CamelDockerTlsVerify, CamelDockerCertPath, CamelDockerCmdExecFactory, CamelDockerUsername, CamelDockerPassword and CamelDockerServerAddress headers. Disabled by default; enable it only when the header source is trusted, since it lets a message choose the Docker daemon that the client connects to and how, and the registry that receives the username and password of the endpoint. | false | boolean | |
The directory with the certificates and the key of the client (ca.pem, cert.pem and key.pem), used when secure is enabled. | String | ||
Password to authenticate with. | String | ||
Whether to connect to the Docker daemon with HTTPS, using the certificates in certPath, which is then required. | false | boolean | |
Check TLS. | false | boolean | |
User name to authenticate with. | String |
Endpoint Options
The Docker endpoint is configured using URI syntax:
docker:operation
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The operation to perform: events and stats for the consumer, the others for the producer. Enum values:
| DockerOperation |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Email address associated with the user. | String | ||
Required Docker host. In socket mode (socket=true), the path of the unix socket of the Docker daemon, where the default localhost means /var/run/docker.sock. A host with a tcp:// or unix:// scheme (such as tcp://myhost:2376 or unix:///var/run/docker.sock) is used as is, and then the port and socket options are not used. | localhost | String | |
The TCP port of the Docker daemon. Not used in socket mode, or when the host is a tcp:// or unix:// URL. | 2375 | Integer | |
The timeout in milliseconds to connect to the Docker daemon, and with JerseyDockerCmdExecFactory also to wait for data of a response. Not used with a cmdExecFactory other than NettyDockerCmdExecFactory and JerseyDockerCmdExecFactory. When not set, the defaults of the transport apply. | Integer | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The fully qualified class name of the DockerCmdExecFactory implementation of docker-java that sends the requests to the Docker daemon, such as com.github.dockerjava.netty.NettyDockerCmdExecFactory (the default) or com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory. | com.github.dockerjava.netty.NettyDockerCmdExecFactory | String | |
Deprecated Whether to follow redirect filter. Deprecation note: Not used: nothing reads this option when the Docker client is built. | false | boolean | |
Deprecated Whether to use logging filter. Deprecation note: Not used: nothing reads this option when the Docker client is built. | false | boolean | |
Not used: the component does not pass this value to the DockerCmdExecFactory. | 100 | Integer | |
Not used: the component does not pass this value to the DockerCmdExecFactory. | 100 | Integer | |
The parameters of the endpoint URI that are not options, such as containerId=myContainer. The component sets them. Each one is the fallback for the CamelDocker header of the same name, such as containerId for CamelDockerContainerId. | Map | ||
The server address of the Docker registry. | String | ||
Socket connection mode. When enabled, connects to the unix socket of the Docker daemon, whose path is given by the host option (the default localhost means /var/run/docker.sock), and the port is not used. When disabled, connects over TCP to the host and port. | false | boolean | |
Whether to allow overriding the connection and credential settings of the endpoint with the CamelDockerHost, CamelDockerPort, CamelDockerSocketEnabled, CamelDockerSecure, CamelDockerTlsVerify, CamelDockerCertPath, CamelDockerCmdExecFactory, CamelDockerUsername, CamelDockerPassword and CamelDockerServerAddress headers. Disabled by default; enable it only when the header source is trusted, since it lets a message choose the Docker daemon that the client connects to and how, and the registry that receives the username and password of the endpoint. | false | boolean | |
The directory with the certificates and the key of the client (ca.pem, cert.pem and key.pem), used when secure is enabled. | String | ||
Password to authenticate with. | String | ||
Whether to connect to the Docker daemon with HTTPS, using the certificates in certPath, which is then required. | false | boolean | |
Check TLS. | false | boolean | |
User name to authenticate with. | String |
Message Headers
The Docker component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelDockerRequestTimeout (common) Constant: | The timeout in milliseconds to connect to the Docker daemon, and with JerseyDockerCmdExecFactory also to wait for data of a response, as the requestTimeout option. | Integer | |
| Constant: | The directory with the certificates and the key of the client, used when secure is enabled. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | String | |
| Constant: | The docker host. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | String | |
| Constant: | The docker port. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | Integer | |
CamelDockerMaxPerRouteConnections (common) Constant: | Not used, as the maxPerRouteConnections option. | Integer | |
CamelDockerMaxTotalConnections (common) Constant: | Not used, as the maxTotalConnections option. | Integer | |
| Constant: | Whether to connect to the Docker daemon with HTTPS. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | false | Boolean |
| Constant: | Check TLS. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | false | Boolean |
CamelDockerSocketEnabled (common) Constant: | Socket connection mode: connect to the unix socket of the Docker daemon, whose path is given by the host (the default localhost means /var/run/docker.sock). This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | false | Boolean |
CamelDockerCmdExecFactory (common) Constant: | The fully qualified class name of the DockerCmdExecFactory implementation to use. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | String | |
| Constant: | For imagelist: only list the images with this label, in the form key or key=value. | String | |
| Constant: | For imagelist: also list the intermediate images. For containerlist: list all containers, not only the running ones. | Boolean | |
CamelDockerContainerId (common) Constant: | The id or name of the container of the container operations, execcreate and networkconnect. The stats consumer reads it from the containerId parameter of the endpoint URI. | String | |
| Constant: | The id or name of the image for imageinspect, imageremove and imagetag. | String | |
| Constant: | The email address associated with the user. | String | |
| Constant: | The password to authenticate with. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | String | |
CamelDockerServerAddress (common) Constant: | The server address of the Docker registry. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | String | |
| Constant: | The user name to authenticate with. This header is ignored unless the endpoint enables allowConnectionAndCredentialsFromHeaders=true (disabled by default). | String | |
| Constant: | The registry. | String | |
CamelDockerRepository (common) Constant: | The repository (image name) for imagecreate, imagepull, imagetag and containercommit. | String | |
| Constant: | The tag for imagepull, imagepush, imagetag and containercommit. For imagebuild, the name and optional tag of the built image, in the form name:tag. | String | |
| Constant: | The image name for imagepush. For containercreate, the name of the container. | String | |
| Constant: | The term to search for with imagesearch. | String | |
| Constant: | For imageremove and imagetag: whether to force the operation. For containerremove: whether to kill and remove a running container. | Boolean | |
| Constant: | For imageremove: whether to keep the untagged parent images. | Boolean | |
CamelDockerInitialRange (common) Constant: | The time in milliseconds before the start of the events consumer from which it also receives the past events. | Long | |
| Constant: | For containerlist: only list the containers created before the container with this id or name, including the ones that are not running. | String | |
| Constant: | For containerlist: only list this number of the last created containers, including the ones that are not running. | Integer | |
| Constant: | For containerlist: whether to include the sizes of the containers. | Boolean | |
| Constant: | For containerlist: only list the containers created after the container with this id or name, including the ones that are not running. | String | |
CamelDockerRemoveVolumes (common) Constant: | For containerremove: whether to also remove the anonymous volumes of the container. | Boolean | |
CamelDockerFollowStream (common) Constant: | For containerattach and containerlog: whether to keep the stream open, so the operation waits until the container stops. | Boolean | |
| Constant: | For containerattach: whether to also return the output that the container wrote before the attach. | Boolean | |
| Constant: | For containerattach and containerlog: whether to include the output of stderr. | Boolean | |
| Constant: | For containerattach and containerlog: whether to include the output of stdout. | Boolean | |
CamelDockerTimestamps (common) Constant: | For containerlog: whether to start each line with its timestamp. Not used by containerattach. | Boolean | |
| Constant: | For containerlog: the number of lines to return from the end of the log. | Integer | |
| Constant: | For containerlog: whether to return all the lines of the log, in place of CamelDockerTail. | Boolean | |
| Constant: | Not used: docker-java does not send the host path of containercopyfile. | String | |
| Constant: | For containercopyfile: the path of the file or directory in the container, which the operation returns as a tar archive. | String | |
CamelDockerContainerIdDiff (common) Constant: | For containerdiff: the id or name of the container, in place of CamelDockerContainerId, which is still required. | String | |
| Constant: | For containerstop and containerrestart: the number of seconds to wait for the container to stop before it is killed. | Integer | |
| Constant: | For containerkill: the signal to send to the container, such as SIGTERM. Docker sends SIGKILL by default. | String | |
| Constant: | For containertop: the arguments of the ps command, such as aux. Docker uses -ef by default. | String | |
| Constant: | For imagebuild: whether to build without the build cache. | Boolean | |
| Constant: | For imagebuild: whether to suppress the verbose build output. | Boolean | |
| Constant: | For imagebuild: whether to remove the intermediate containers after a successful build. Docker removes them by default. | Boolean | |
CamelDockerAttachStdErr (common) Constant: | For containercommit, containercreate and execcreate: whether to attach stderr. | Boolean | |
CamelDockerAttachStdIn (common) Constant: | For containercommit, containercreate and execcreate: whether to attach stdin. | Boolean | |
CamelDockerAttachStdOut (common) Constant: | For containercommit, containercreate and execcreate: whether to attach stdout. | Boolean | |
| Constant: | For containercommit: the author of the image. | String | |
| Constant: | For containercommit, containercreate and execcreate: the command to run, as a String[] or a String with the arguments separated by semicolons. | String or String[] | |
CamelDockerDisableNetwork (common) Constant: | For containercommit and containercreate: whether to disable the networking of the container. | Boolean | |
| Constant: | For containercommit and containercreate: the environment variables in the form NAME=value, as a String[] or a String with the variables separated by semicolons. | String or String[] | |
CamelDockerExposedPorts (common) Constant: | The ports that the container exposes: an ExposedPorts for containercommit, an ExposedPort or ExposedPort[] for containercreate. | ExposedPort[] | |
| Constant: | For containercommit and containercreate: the host name of the container. | String | |
| Constant: | For containercommit: the commit message. | String | |
| Constant: | For containercommit: the memory limit in bytes. | Integer | |
CamelDockerMemorySwap (common) Constant: | For containercommit and containercreate: the limit of the memory plus the swap in bytes. | Long or Integer | |
| Constant: | For containercommit: whether to keep stdin open. | Boolean | |
| Constant: | For containercommit: whether to pause the container while it is committed. | Boolean | |
| Constant: | For containercommit and containercreate: the port specs, as a String[] or a String with the specs separated by semicolons. | String or String[] | |
| Constant: | For containercommit and containercreate: whether to close stdin after the first attached client disconnects. | Boolean | |
| Constant: | For containercommit, containercreate, execcreate and execstart: whether to allocate a pseudo-TTY. | Boolean | |
| Constant: | For containercommit and containercreate: the user that runs the commands in the container. | String | |
| Constant: | The volumes of the container: a Volumes for containercommit, a Volume or Volume[] for containercreate. | Volume[] | |
CamelDockerWorkingDir (common) Constant: | For containercommit and containercreate: the working directory of the commands in the container. | String | |
| Constant: | For containercreate: the CPU shares (relative weight) of the container. | Integer | |
| Constant: | For containercreate: the DNS servers, as a String[] or a String with the servers separated by semicolons. | String or String[] | |
CamelDockerEntryPoint (common) Constant: | For containercreate: the entrypoint, as a String[] or a String. | String or String[] | |
CamelDockerHostConfig (common) Constant: | For containercreate: the host configuration of the container. It replaces the one that CamelDockerCapAdd, CamelDockerCapDrop, CamelDockerCpuShares and CamelDockerDns configure. | HostConfig | |
| Constant: | For containercreate: the image to create the container from. | String | |
CamelDockerMemoryLimit (common) Constant: | For containercreate: the memory limit of the container in bytes. | Long | |
| Constant: | For containercreate: whether to keep stdin open. | Boolean | |
CamelDockerVolumesFrom (common) Constant: | For containercreate: the containers whose volumes to mount, as a VolumesFrom or VolumesFrom[]. | VolumesFrom[] | |
CamelDockerDomainName (common) Constant: | For containercreate: the domain name of the container. | String | |
| Constant: | For containercreate: the bind mounts of the container, as a Bind or Bind[]. | Bind[] | |
| Constant: | For containercreate: the Linux capabilities to add to the container, as a Capability or Capability[]. | Capability[] | |
| Constant: | For containercreate: the Linux capabilities to drop from the container, as a Capability or Capability[]. | Capability[] | |
| Constant: | For networkcreate: the name of the network. For networkremove and networkconnect: the id or name of the network. | String | |
| Constant: | For execstart: whether to detach from the command, so the operation does not wait for its output. | Boolean | |
| Constant: | For execstart: the id of the exec instance that execcreate created. | String |
Message Body
The message body at each side of the Docker component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| The object of docker-java for each item of the stream: an Event of the daemon with events, the Statistics of the container in CamelDockerContainerId with stats.
|
Producer input |
| Not used by most operations, which take their input from the options and headers, such as the container in CamelDockerContainerId. imagecreate reads the image as a stream; imagebuild needs the build context as a tar archive (an InputStream, a byte[] or another body that converts to an InputStream) or as a java.io.File of the Dockerfile or its directory, and fails without one.
|
Producer output |
| The response of docker-java for the operation, such as the Version of version and a List of Containers for containerlist; the operations without a response, such as ping and containerstart, keep the body. The streaming operations wait until the stream is done: containerattach, containerlog and execstart give the output of stdout and stderr as text, containerwait the exit code of the container, imagebuild the id of the built image, imagepull and imagepush the last item of the progress; a failed build, pull or push fails the exchange.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Usage
Connecting to the Docker daemon
By default, the component connects over TCP to host and port (tcp://localhost:2375). Docker does not open this TCP port by default; it has to be enabled in the configuration of the daemon.
To connect to the local unix socket of the daemon instead, set socket=true. In socket mode host is the path of the socket and port is not used. The default host localhost means /var/run/docker.sock:
from("timer:info?repeatCount=1")
.to("docker:info?socket=true")
.log("${body}"); For a socket in another place, set its path as the host, for example docker:info?socket=true&host=/run/user/1000/docker.sock.
The host can also be a full Docker host URL with a tcp:// or unix:// scheme, in the same form as the DOCKER_HOST environment variable, such as tcp://myhost:2376 or unix:///var/run/docker.sock. Such a host is used as is, and the port and socket options are not used. Windows named pipes (npipe://) are not supported by the Docker client of the component.
Header Strategy
All URI options 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 Option | Header Property |
|---|---|
containerId | CamelDockerContainerId |
The headers of the connection and credential settings are the exception: CamelDockerHost, CamelDockerPort, CamelDockerSocketEnabled, CamelDockerSecure, CamelDockerTlsVerify, CamelDockerCertPath, CamelDockerCmdExecFactory, CamelDockerUsername, CamelDockerPassword and CamelDockerServerAddress are ignored unless the endpoint sets allowConnectionAndCredentialsFromHeaders=true. Without this option, the producer connects to the Docker daemon of the endpoint, in the way the endpoint configures, and gives the username and password of the endpoint to the registry of the endpoint, whatever the headers of the message say.
Enable allowConnectionAndCredentialsFromHeaders only when the headers come from a trusted source, since with it a message chooses the Docker daemon that the client connects to and how (TLS, the client certificates and the DockerCmdExecFactory class), and the registry that receives the username and password of the endpoint. Set on the component, the option applies to all its endpoints.
The other headers, such as CamelDockerContainerId, still take precedence over the options of the endpoint. When the messages come from an untrusted producer through a consumer that does not filter out Camel* headers, remove these headers with removeHeaders("CamelDocker*") before the docker endpoint.
Registry authentication
The imagepull and imagepush operations send the username, password and email of the endpoint only for an image in the registry of serverAddress: the registry host and port of the image reference must match those of serverAddress. An image reference without a registry host, such as ubuntu or team/app, is on Docker Hub, which matches the default serverAddress (https://index.docker.io/v1/). An image in another registry is pulled or pushed without authentication, and so is every image when the endpoint has no username. To pull or push with authentication from several registries, use one endpoint per registry.
Streaming operations
The operations imagebuild, imagepull, imagepush, containerattach, containerlog, containerwait and execstart wait until Docker has finished, and set the result as the message body:
-
imagebuild: the id of the built image. The body is the build context: a tar archive as anInputStream, abyte[]or another body that converts to anInputStream, or ajava.io.Fileof the Dockerfile or its directory. -
containerattach,containerlogandexecstart: the output of stdout and stderr as aString. -
containerwait: the exit code of the container as anInteger. -
imagepullandimagepush: the lastPullResponseItemorPushResponseItemof the progress.
When the operation fails, for example a build step that fails, the exchange fails.
With followStream=true, containerattach and containerlog wait until the container stops. |
Examples
The following example consumes events from Docker:
-
Java
-
XML
-
YAML
from("docker://events?host=192.168.59.103&port=2375").to("log:event"); <route>
<from uri="docker://events?host=192.168.59.103&port=2375"/>
<to uri="log:event"/>
</route> - route:
from:
uri: docker://events
parameters:
host: 192.168.59.103
port: 2375
steps:
- to:
uri: log:event The following example queries Docker for system-wide information
-
Java
-
XML
-
YAML
from("docker://info?host=192.168.59.103&port=2375").to("log:info"); <route>
<from uri="docker://info?host=192.168.59.103&port=2375"/>
<to uri="log:info"/>
</route> - route:
from:
uri: docker://info
parameters:
host: 192.168.59.103
port: 2375
steps:
- to:
uri: 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 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>