Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.

Camel Docker component

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.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-docker</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

docker://[operation]?[options]

Where operation is the specific action to perform on Docker.

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
containerIdCamelDockerContainerId

General Options

The following parameters can be used with any invocation of the component

OptionHeaderDescriptionDefault Value
hostCamelDockerHostMandatory: Docker host localhost
portCamelDockerPortMandatory: Docker port2375
usernameCamelDockerUserNameUser name to authenticate with 
passwordCamelDockerPasswordPassword to authenticate with 
emailCamelDockerEmailEmail address associated with the user 
secureCamelDockerSecureUse HTTPS communication false
requestTimeoutCamelDockerRequestTimeoutRequest timeout for response (in seconds)30
certPathCamelDockerCertPathLocation containing the SSL certificate chain 

Consumer Operations

The consumer supports the following operations.

OperationOptionsDescriptionProduces
eventsinitialRangeMonitor Docker events (Streaming)Event

Producer Operations

The following producer operations are available.

Misc OperationOptionsDescriptionReturns
auth Check auth configuration 
info System wide informationInfo
ping Ping the Docker server 
version Show the docker version informationVersion
Image OperationOptionsDescriptionBody ContentReturns
image/listfilter, showAllList images List<Image>
image/createrepositoryCreate an imageInputStreamCreateImageResponse
 image/buildnoCache, quiet, remove, tagBuild an image from Dockerfile via stdinInputStream or FileInputStream
image/pullrepository, registry, tagPull an image from the registry  InputStream
image/pushnamePush an image on the registry InputStream
image/searchtermSearch for images List<SearchItem>
image/removeimageIdRemove an image  
 image/tag imageId, repository, tag, forceTag an image into a repository  
image/inspectimageIdInspect an image InspectImageResponse
Container OperationOptionsDescriptionBody ContentReturns
container/listshowSize, showAll, before, since, limit, List containersinitialRange List<Container>
container/createimageId, name, exposedPorts, workingDir, disableNetwork, hostname,
user, tty, stdInOpen, stdInOnce, memoryLimit, memorySwap, cpuShares,
attachStdIn, attachStdOut, attachStdErr, env, cmd, dns, image, volumes,
volumesFrom
Create a container  CreateContainerResponse
 container/start

containerId, binds, links, lxcConf, portBindings, privileged, publishAllPorts,
dns, dnsSearch, volumesFrom, networkMode, devices, restartPolicy,
capAdd, capDrop

Start a container  
 container/inspectcontainerIdInspect a container  InspectContainerResponse
 container/waitcontainerIdWait a containerInteger 
container/logcontainerId, stdOut, stdErr, timestamps, followStream, tailAll, tailGet container logs  InputStream
container/attachcontainerId, stdOut, stdErr, timestamps, logs, followStreamAttach to a container InputStream
container/stopcontainerId, timeoutStop a container  
container/restartcontainerId, timeoutRestart a container  
container/diffcontainerIdInspect changes on a container ChangeLog
container/killcontainerId, signalKill a container  
container/topcontainerId, psArgsList processes running in a container TopContainerResponse
container/pausecontainerIdPause a container  
container/unpausecontainerIdUnpause a container  
container/commitcontainerId, repository, message, tag, attachStdIn, attachStdOut, attachStdErr,
cmd, disableNetwork, pause, env, exposedPorts, hostname, memory, memorySwap,
openStdIn, portSpecs, stdInOnce, tty, user, volumes, hostname
Create a new image from a container's changesString 
container/copyfilecontainerId, resource, hostPathCopy files or folders from a containerInputStream 
container/removecontainerId, force, removeVolumes Remove a container  

 

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");

 

 

 

© 2004-2015 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram