tree: fe75689df39f182643bd986b3acb1229e995e792 [path history] [tgz]
  1. README.md
  2. pom.xml
  3. src/
components/camel-docker/README.md

Docker Camel Component

Camel component for communicating with Docker.

Docker Remote API

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

URI Format

docker://[operation]?[options]

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

Configuration

Options on the Docker Endpoint mapped to a DockerConfiguration POJO. This object contains the values integral to the communication with the Docker sever as first order attributes along with a Map of additional parameters based on the options for each type of interaction.

The following are the the primary options for communicating with the Docker server

OptionHeaderDescriptionDefault Value
hostCamelDockerHostDocker hostlocalhost
portCamelDockerPortDocker port2375
usernameCamelDockerUserNameUser name to authenticate with
passwordCamelDockerPasswordPassword to authenticate with
secureCamelDockerSecureUse HTTPS communicationfalse
certPathCamelDockerCertPathLocation containing the SSL certificate chain
emailCamelDockerEmailEmail address associated with the user
requestTimeoutCamelDockerRequestTimeoutRequest timeout for response (in seconds)30
serverAddressCamelDockerServerAddressAddress of the Docker registry server (If not specified, host will be used)https://index.docker.io/v1/
maxTotalConnectionsCamelDockerMaxTotalConnectionsMaximum number of total connections100
maxPerRouteConnectionsCamelDockerMaxPerRouteConnectionsMaximum number of connections per route100

Consumer Operations

OperationOptionsDescriptionProduces
eventsinitialRangeAmount of time in the past to begin receiving events (Long)Event
statisticscontainerIdStatistics based on resource usageStatistics

Producer Operations

The following producer operations are available

General

OperationOptionsDescriptionReturns
authValues obtained from the component general optionsValidate auth configurationAuthResponse
infoSystem wide informationInfo
pingPing the Docker server
versionShow the docker version informationVersion

Images

OperationOptionsDescriptionBody ContentReturns
image/buildnoCache, quiet, remove, tagBuild an image from Dockerfile via stdinInputStream or FileInputStream
image/createrepositoryCreate an imageInputStreamCreateImageResponse
image/inspectimageIdInspect an imageInspectImageResponse
image/listfilter, showAllList imagesList<Image>
image/pullrepository, registry, tagPull an image from the registryInputStream
image/pushname, tagPush an image on the registryInputStream
image/removeimageId, force, noPruneRemove an image
image/searchtermSearch for imagesList<SearchItem>
image/tagimageId, repository, tag, forceTag an image into a repository

Containers

| Operation | Options | Description | Body Content | Returns | | ------------- | ---------------- | ------------- | ---------------- | | container/attach | containerId, followStream, logs, stdErr, stdOut, timestamps | Attach to a container | | InputStream | | container/commit | containerId, author, attachStdErr, attachStdIn, attachStdOut, cmd, disableNetwork, env, exposedPorts, hostname, memory, memorySwap, message, openStdIn, pause, portSpecs, repository, stdInOnce, tag, tty, user, volumes, workingDir | Create a new image from a container's changes | | String | | container/copyfile | containerId, resource, hostPath | Copy files or folders from a container | | InputStream | | container/create | image, attachStdErr, attachStdIn, attachStdOut, capAdd, capDrop, cmd, cpuShares, disableNetwork, dns, domanName, entrypoint, env, exposedPorts, hostConfig, hostname, memoryLimit, memorySwap, name, portSpecs, stdInOnce, stdInOpen, tty, user, volumes, volumesFrom, workingDir | Create a container | |CreateContainerResponse | | container/diff | containerId, containerIdDiff | Differences on the container filesystem | | List<ChangeLog> | | container/inspect | containerId | Inspect a container | | InspectContainerResponse | | container/kill | containerId, signal | Kill a container | | | | container/list | before, limit, showSize, showAll, since | List containers | | List<Container> | | container/log | containerId, followStream, stdErr, stdOut, tail, tailAll, timestamps | Get container logs | | InputStream | | container/pause | containerId | Pause a container | | | | container/remove | containerId, force, removeVolumes | Remove a container | | | | container/restart | containerId, timeout | Restart a container | | | container/start | containerId | Start a container | | | | container/stop | containerId, timeout | Stop a container | | | container/top | containerId, psArgs | List processes running in a container | |TopContainerResponse | | container/unpause | containerId | Unpause a container | | | | container/wait | containerId | Blocks until a container is stopped | | |

Exec

| Operation | Options | Description | Body Content | Returns | | ------------- | ---------------- | ------------- | ---------------- | | exec/create | containerId, attachStdErr, attachStdIn, attachStdOut, cmd, tty | Setup an exec instance on a running container | | ExecCreateCmdResponse | | exec/start | containerId, detach, execId, tty | Starts a previously created exec instance | |InputStream |

Examples

The following example consumes events from Docker

docker://events?host=192.168.59.103&port=2375

The following example queries Docker for system wide information

docker://info?host=192.168.59.103&port=2375