Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
Chapter 37. Docker
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:
URI format 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
docker://[operation]?[options]
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 Option | Header Property |
---|---|
containerId | CamelDockerContainerId |
General Options 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The following parameters can be used with any invocation of the component
Option | Header | Description | Default Value |
---|---|---|---|
host | CamelDockerHost | Mandatory: Docker host | localhost |
port | CamelDockerPort | Mandatory:Docker port | 2375 |
username | CamelDockerUserName | User name to authenticate with | |
password | CamelDockerPassword | Password to authenticate with | |
CamelDockerEmail | Email address associated with the user | ||
secure | CamelDockerSecure | Use HTTPS communication | false |
requestTimeout | CamelDockerRequestTimeout | Request timeout for response (in seconds) | 30 |
certPath | CamelDockerCertPath | Location containing the SSL certificate chain |
Consumer Operations 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The consumer supports the following operations.
Operation | Options | Description | Produces |
---|---|---|---|
events | initialRange | Monitor Docker events (Streaming) | Event |
Producer Operations 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The following producer operations are available.
Misc Operation | Options | Description | Returns |
---|---|---|---|
auth | Check auth configuration | ||
info | System wide information | Info | |
ping | Ping the Docker server | ||
version | Show the docker version information | Version |
Image Operation | Options | Description | Body Content | Returns |
---|---|---|---|---|
image/list | filter, showAll | List images | List<Image> | |
image/create | repository | Create an image | InputStream | CreateImageResponse |
image/build | noCache, quiet, remove, tag | Build an image from Dockerfile via stdin | InputStream or File | InputStream |
image/pull | repository, registry, tag | Pull an image from the registry | InputStream | |
image/push | name | Push an image on the registry | InputStream | |
image/search | term | Search for images | List<SearchItem> | |
image/remove | imageId | Remove an image | ||
image/tag | imageId, repository, tag, force | Tag an image into a repository | ||
image/inspect | imageId | Inspect an image | InspectImageResponse |
Container Operation | Options | Description | Body Content | Returns |
---|---|---|---|---|
container/list | showSize, showAll, before, since, limit, List containers | initialRange | List<Container> | |
container/create | imageId, 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/inspect | containerId | Inspect a container | InspectContainerResponse | |
container/wait | containerId | Wait a container | Integer | |
container/log | containerId, stdOut, stdErr, timestamps, followStream, tailAll, tail | Get container logs | InputStream | |
container/attach | containerId, stdOut, stdErr, timestamps, logs, followStream | Attach to a container | InputStream | |
container/stop | containerId, timeout | Stop a container | ||
container/restart | containerId, timeout | Restart a container | ||
container/diff | containerId | Inspect changes on a container | ChangeLog | |
container/kill | containerId, signal | Kill a container | ||
container/top | containerId, psArgs | List processes running in a container | TopContainerResponse | |
container/pause | containerId | Pause a container | ||
container/unpause | containerId | Unpause a container | ||
container/commit | containerId, 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 changes | String | |
container/copyfile | containerId, resource, hostPath | Copy files or folders from a container | InputStream | |
container/remove | containerId, 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");
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");
from("docker://info?host=192.168.59.103&port=2375").to("log:info");