diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..a96e5522
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+.git/
+target/
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..9a39f917
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,17 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Unix shell files use Unix line endings
+*.sh text eol=lf
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..985c3569
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,6 @@
+language: java
+jdk:
+ - oraclejdk7
+after_success:
+ - echo "ossrh\${env.OSSRH_USER}\${env.OSSRH_PASS}" > ~/settings.xml
+ - mvn deploy -DskipITs --settings ~/settings.xml
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..ea311817
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,179 @@
+Change Log
+===
+Latest SNAPSHOT
+---
+
+v1.3.0
+---
+* [#213](https://github.com/docker-java/docker-java/pull/213) Add ulimit support
+* [#208](https://github.com/docker-java/docker-java/pull/208) Added PullEventStreamItem and EventStreamReader to stream the reading of events
+* [#205](https://github.com/docker-java/docker-java/issues/205) Access mode of VolumesRW incorrectly deserialized
+* [#204] (https://github.com/docker-java/docker-java/pull/204) Added support to use the credentials from .dockercfg during build
+* [#203](https://github.com/docker-java/docker-java/issues/203) Missing 'MacAddress' option in create container command
+* [#197](https://github.com/docker-java/docker-java/pull/197) Allow for null bindings
+
+v1.2.0
+---
+* [#194](https://github.com/docker-java/docker-java/pull/194) Fixed remove intermediate containers bug on build goal
+* [#193](https://github.com/docker-java/docker-java/pull/193) Add HostConfig related methods from start command to create command
+* [#192](https://github.com/docker-java/docker-java/pull/192) Added a Links constructor accepting a List object
+
+v1.1.0
+---
+
+ * [#186](https://github.com/docker-java/docker-java/pull/186) Added withPull method to BuilImageCmd
+ * [#185](https://github.com/docker-java/docker-java/pull/185) Introduce WrappedResponseInputStream to close underlying Response
+ * [#180](https://github.com/docker-java/docker-java/pull/180) Dockerfiles not called 'dockerfile'
+ * [#179](https://github.com/docker-java/docker-java/pull/179) Add support for cpuset in CreateContainerCmd
+ * [#170](https://github.com/docker-java/docker-java/pull/170) Allow to specify alternative files other than 'Dockerfile' for building images
+ * [#165](https://github.com/docker-java/docker-java/pull/165) PushImageCmd assumes that you have an auth config setup
+ * [#161](https://github.com/docker-java/docker-java/pull/161) Inspect exec command
+ * [#159](https://github.com/docker-java/docker-java/pull/159) Add missing Info fields
+ * [#156](https://github.com/docker-java/docker-java/pull/156) Add support for configuring ExtraHosts
+ * [#146](https://github.com/docker-java/docker-java/pull/146) Create Identifier type
+
+
+v1.0.0
+---
+ * [#152](https://github.com/docker-java/docker-java/pull/152) Restore guava as a dependency
+ * [#149](https://github.com/docker-java/docker-java/pull/149) Handle HTTP-Redirects
+ * [#148](https://github.com/docker-java/docker-java/pull/148) Save image functionality
+ * [#142](https://github.com/docker-java/docker-java/pull/142) Reduce Logging Level
+ * [#138](https://github.com/docker-java/docker-java/pull/138) Apache CXF interopabilty
+ * [#137](https://github.com/docker-java/docker-java/pull/137) Multiple volumesFrom option when creating a container
+ * [#135](https://github.com/docker-java/docker-java/pull/135) Update to latest unix-socket-factory
+ * [#134](https://github.com/docker-java/docker-java/pull/134) Remove Google Guava as dependency
+ * [#131](https://github.com/docker-java/docker-java/pull/128) Utility classes and streamed JSON representations
+ * [#128](https://github.com/docker-java/docker-java/pull/128) Allow unauthorized pullImageCmd
+
+v0.10.5
+---
+ * [#125](https://github.com/docker-java/docker-java/pull/125) Unixsocket support
+ * [#123](https://github.com/docker-java/docker-java/pull/123) support DOCKER_TLS_VERIFY to detect ssl
+ * [#121](https://github.com/docker-java/docker-java/pull/121) Implemented support for commands: Exec-start, Exec-create
+ * [#120](https://github.com/docker-java/docker-java/pull/120) Command resource cleanup after command execution
+ * [#118](https://github.com/docker-java/docker-java/pull/118) Use chunked encoding when passing the docker image
+ * [#116](https://github.com/docker-java/docker-java/pull/116) Allow SSL configuration from pre-existing keystore to be used
+ * [#115](https://github.com/docker-java/docker-java/pull/115) Polish RestartPolicy
+ * [#114](https://github.com/docker-java/docker-java/pull/114) Fix CreateContainerCmdImpl.withVolumesFrom()
+ * [#111](https://github.com/docker-java/docker-java/pull/111) Allow to send empty messages in StartContainerCmd
+
+v0.10.4
+---
+
+ * [#109](https://github.com/docker-java/docker-java/pull/109) Support tag in push image command
+ * [#106](https://github.com/docker-java/docker-java/pull/106) Allow to manage Linux capabilities in CreateContainerCmd
+ * [#105](https://github.com/docker-java/docker-java/pull/105) Allow to pass HostConfig when creating a container
+ * [#103](https://github.com/docker-java/docker-java/pull/103) Make GoLangMatchFileFilter work on Windows
+ * [#102](https://github.com/docker-java/docker-java/pull/102) Downgraded jackson-jaxrs dependency version
+ * [#101](https://github.com/docker-java/docker-java/pull/101) list filtered images as described in the remote api docs
+ * [#100](https://github.com/docker-java/docker-java/pull/100) Add support for .dockercfg files to handle auth for push command
+ * [#95](https://github.com/docker-java/docker-java/pull/95) Add support for .dockerignore files
+ * [#92](https://github.com/docker-java/docker-java/pull/92) Add travis-ci support
+ * [#90](https://github.com/docker-java/docker-java/pull/90) Update DockerClientBuilder.java
+ * [#88](https://github.com/docker-java/docker-java/pull/88) Add support for private repositories and pull/push authentication
+
+v0.10.3
+---
+
+ * [#87](https://github.com/docker-java/docker-java/pull/87) Improve adding of port bindings
+ * [#83](https://github.com/docker-java/docker-java/pull/83) Loading of custom DockerCmdExecFactory
+ * [#81](https://github.com/docker-java/docker-java/pull/81) Env config
+ * [#82](https://github.com/docker-java/docker-java/pull/82) Allow multiple port bindings per ExposedPort
+ * [#80](https://github.com/docker-java/docker-java/pull/80) explicitly use the latest image version
+ * [#79](https://github.com/docker-java/docker-java/pull/79) Move slow tests to integration test phase, enable tests by default
+ * [#76](https://github.com/docker-java/docker-java/pull/76) New enum \"InternetProtocol\" for supported IP protocols replaces \"scheme\"
+ * [#75](https://github.com/docker-java/docker-java/pull/75) Use ExposedPort.toString() in serialization
+ * [#74](https://github.com/docker-java/docker-java/pull/74) Use project.build.sourceEncoding in compiler
+ * [#73](https://github.com/docker-java/docker-java/pull/73) Improve parsing and serialization of Link
+ * [#70](https://github.com/docker-java/docker-java/pull/70) Improve instantiation and serialization of Bind
+
+v0.10.2
+---
+
+ * [#69](https://github.com/docker-java/docker-java/pull/69) Use canonical form of Docker folder when building TAR files
+ * [#68](https://github.com/docker-java/docker-java/pull/68) Set Jersey client CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE
+ * [#67](https://github.com/docker-java/docker-java/pull/67) typo in README.md
+ * [#65](https://github.com/docker-java/docker-java/pull/65) Added static method udp in ExposedPort
+ * [#63](https://github.com/docker-java/docker-java/pull/63) Bind.parse() fails when access mode is specified
+ * [#57](https://github.com/docker-java/docker-java/pull/57) Add streaming events API
+ * [#59](https://github.com/docker-java/docker-java/pull/59) Update readme to include corrected api example
+ * [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
+ * [#56](https://github.com/docker-java/docker-java/pull/56) Update README.md
+ * [#58](https://github.com/docker-java/docker-java/pull/58) Code clear and bug fix
+
+v0.10.1
+---
+
+ * [#49](https://github.com/docker-java/docker-java/pull/49) Allow user to check where volume is binded on host
+ * [#47](https://github.com/docker-java/docker-java/pull/47) let CompressArchiveUtil preserve executable flags
+ * [#46](https://github.com/docker-java/docker-java/pull/46) Fixes to AttachContainerCmd and CreateContainerCmd.
+
+v0.10.0
+---
+
+ * [#45](https://github.com/docker-java/docker-java/pull/45) Fix Issue #44 Adjusting DNS property type to be a String array as specified by the Doc...
+ * [#38](https://github.com/docker-java/docker-java/pull/38) Remove special-case for one \":\" from PullCommand
+ * [#37](https://github.com/docker-java/docker-java/pull/37) Starts v0.10.0
+ * [#35](https://github.com/docker-java/docker-java/pull/35) Exposing the withTTY method for container creation.
+
+v0.9.1
+---
+
+ * [#31](https://github.com/docker-java/docker-java/pull/31) Change VolumesFrom to handle array
+ * [#29](https://github.com/docker-java/docker-java/pull/29) Makes Config a public, immutable class with a builder
+ * [#22](https://github.com/docker-java/docker-java/pull/22) Fixes for startContainerCmd
+ * [#19](https://github.com/docker-java/docker-java/pull/19) Add missing options to BuildCmd and set them to match Docker client.
+ * [#16](https://github.com/docker-java/docker-java/pull/16) Build image improvements
+
+v0.9.0
+---
+
+ * [#14](https://github.com/docker-java/docker-java/pull/14) Use RegEx to match ADD command from Dockerfile.
+ * [#9](https://github.com/docker-java/docker-java/pull/9) Add a build command accepting a tar as a InputStream, so we can build the Dockerfile TAR on the fly without a temporary folder.
+
+v0.8.2
+---
+
+ * [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
+ * [#1](https://github.com/docker-java/docker-java/pull/1) Merge
+ * [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
+ * [#66](https://github.com/docker-java/docker-java/pull/66) Backport the new structure to Jersey 1.18
+ * [#65](https://github.com/docker-java/docker-java/pull/65) Added static method udp in ExposedPort
+ * [#61](https://github.com/docker-java/docker-java/pull/61)
+ * [#60](https://github.com/docker-java/docker-java/pull/60) Added additional callback methods to EventCallback
+ * [#1](https://github.com/docker-java/docker-java/pull/1) Merge
+ * [#55](https://github.com/docker-java/docker-java/pull/55)
+ * [#58](https://github.com/docker-java/docker-java/pull/58) Code clear and bug fix
+ * [#54](https://github.com/docker-java/docker-java/pull/54)
+ * [#3](https://github.com/docker-java/docker-java/pull/3)
+ * [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
+ * [#1](https://github.com/docker-java/docker-java/pull/1) Merge
+ * [#34](https://github.com/docker-java/docker-java/pull/34)
+ * [#36](https://github.com/docker-java/docker-java/pull/36)
+ * [#37](https://github.com/docker-java/docker-java/pull/37) Starts v0.10.0
+ * [#32](https://github.com/docker-java/docker-java/pull/32)
+
+v0.8.1
+---
+
+
+v0.8.1
+---
+
+ * [#28](https://github.com/docker-java/docker-java/pull/28) Improves use of docker-java in unit tests
+ * [#30](https://github.com/docker-java/docker-java/pull/30) Add ping method
+ * [#27](https://github.com/docker-java/docker-java/pull/27) Added a close method to DockerClient
+ * [#26](https://github.com/docker-java/docker-java/pull/26)
+ * [#24](https://github.com/docker-java/docker-java/pull/24)
+ * [#23](https://github.com/docker-java/docker-java/pull/23)
+ * [#22](https://github.com/docker-java/docker-java/pull/22) Fixes for startContainerCmd
+ * [#20](https://github.com/docker-java/docker-java/pull/20)
+ * [#19](https://github.com/docker-java/docker-java/pull/19) Add missing options to BuildCmd and set them to match Docker client.
+ * [#18](https://github.com/docker-java/docker-java/pull/18) Added Container-Linking
+ * [#16](https://github.com/docker-java/docker-java/pull/16) Build image improvements
+ * [#15](https://github.com/docker-java/docker-java/pull/15) Collection of changes driven by use in gradle-docker and on Windows
+ * [#14](https://github.com/docker-java/docker-java/pull/14) Use RegEx to match ADD command from Dockerfile.
+ * [#9](https://github.com/docker-java/docker-java/pull/9) Add a build command accepting a tar as a InputStream, so we can build the Dockerfile TAR on the fly without a temporary folder.
+ * [#5](https://github.com/docker-java/docker-java/pull/5) add paused field in ContainerInspectResponse
+ * [#6](https://github.com/docker-java/docker-java/pull/6)
diff --git a/LICENSE b/LICENSE
index d6456956..38275f2f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright [yyyy] [name of copyright owner]
+ Copyright [2013] [docker-java@googlegroups.com]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 24cfc9ad..4c77e896 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,12 @@
-# docker-java
+[](https://travis-ci.org/docker-java/docker-java)
+[](https://circleci.com/gh/docker-java/docker-java)
+# docker-java
Java API client for [Docker](http://docs.docker.io/ "Docker")
-Supports a subset of the Docker Client API v1.11, Docker Server version 0.11
+Supports a subset of the Docker Client API v1.18, Docker Server version 1.6.0
+
+The current implementation is based on Jersey 2.x and therefore classpath incompatible with older Jersey 1.x dependent libraries!
Developer forum for [docker-java](https://groups.google.com/forum/?hl=de#!forum/docker-java-dev "docker-java")
@@ -10,136 +14,127 @@ Developer forum for [docker-java](https://groups.google.com/forum/?hl=de#!forum/
###### Prerequisites:
-* Java 1.6+
+* Java 1.7
* Maven 3.0.5
* Docker daemon running
-Maven may run tests during build process but tests are disabled by default. The tests are using a localhost instance of Docker, make sure that you have Docker running for tests to work. To run the tests you have to provide your https://www.docker.io/account/login/ information:
-
- $ mvn clean install -DskipTests=false -Ddocker.io.username=... -Ddocker.io.password=... -Ddocker.io.email=...
-
-By default Docker server is using UNIX sockets for communication with the Docker client, however docker-java
-client uses TCP/IP to connect to the Docker server, so you will need to make sure that your Docker server is
-listening on TCP port. To allow Docker server to use TCP add the following line to /etc/default/docker
-
- DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"
-
-More details setting up docket server can be found in official documentation: http://docs.docker.io/en/latest/use/basics/
-
-Now make sure that docker is up:
-
- $ docker -H tcp://127.0.0.1:4243 version
-
- Client version: 0.8.1
- Go version (client): go1.2
- Git commit (client): a1598d1
- Server version: 0.8.1
- Git commit (server): a1598d1
- Go version (server): go1.2
- Last stable version: 0.8.1
+If you need SSL, then you'll need to put your `*.pem` file into `~/.docker/`, if you're using boot2docker, do this:
+
+ $ ln -s /Users/alex.collins/.boot2docker/certs/boot2docker-vm .docker
-Run build with tests:
+Build and run integration tests as follows:
$ mvn clean install
-## Docker-Java maven dependency:
-
-
- com.kpelykh
- docker-java
- 0.8.1
-
-
-
-## Example code snippets:
-
- DockerClient dockerClient = new DockerClient("http://localhost:4243");
+If you do not have access to a Docker server or just want to execute the build quickly, you can run the build without the integration tests:
-###### Get Docker info:
+ $ mvn clean install -DskipITs
- Info info = dockerClient.info();
- System.out.print(info);
-
-###### Search Docker repository:
-
- List dockerSearch = dockerClient.search("busybox");
- System.out.println("Search returned" + dockerSearch.toString());
-
-###### Create new Docker container, wait for its start and stop it:
+By default Docker server is using UNIX sockets for communication with the Docker client, however docker-java
+client uses TCP/IP to connect to the Docker server by default, so you will need to make sure that your Docker server is
+listening on TCP port. To allow Docker server to use TCP add the following line to /etc/default/docker
- ContainerConfig containerConfig = new ContainerConfig();
- containerConfig.setImage("busybox");
- containerConfig.setCmd(new String[] {"touch", "/test"});
- ContainerCreateResponse container = dockerClient.createContainer(containerConfig);
+ DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"
- dockerClient.startContainer(container.id);
+However you can force docker-java to use UNIX socket communication by configure the following url:
- dockerClient.waitContainer(container.id);
+ unix:///var/run/docker.sock
- dockerClient.stopContainer(container.id);
+More details setting up Docker server can be found in official documentation: http://docs.docker.io/en/latest/use/basics/
+Now make sure that docker is up:
-##### Support for UNIX sockets:
+ $ docker -H tcp://127.0.0.1:2375 version
- Support for UNIX socket should appear in docker-java pretty soon. I'm working on its integration.
+ Client version: 0.8.0
+ Go version (client): go1.2
+ Git commit (client): cc3a8c8
+ Server version: 1.2.0
+ Git commit (server): fa7b24f
+ Go version (server): go1.3.1
-##### Docker Builder:
+Run build without integration tests:
-To use Docker Builder, as described on page http://docs.docker.io/en/latest/use/builder/,
-user dockerClient.build(baseDir), where baseDir is a path to folder containing Dockerfile.
+ $ mvn clean install -DskipITs
+## Docker-Java maven dependencies
- File baseDir = new File("~/kpelykh/docker/netcat");
+### Latest release version
- ClientResponse response = dockerClient.build(baseDir);
+
+ com.github.docker-java
+ docker-java
+ 1.3.0
+
- StringWriter logwriter = new StringWriter();
+### Latest SNAPSHOT version
+You can find the latest SNAPSHOT version including javadoc and source files on [Sonatypes OSS repository](https://oss.sonatype.org/content/groups/public/com/github/docker-java/docker-java/).
- try {
- LineIterator itr = IOUtils.lineIterator(response.getEntityInputStream(), "UTF-8");
- while (itr.hasNext()) {
- String line = itr.next();
- logwriter.write(line);
- LOG.info(line);
- }
- } finally {
- IOUtils.closeQuietly(response.getEntityInputStream());
- }
+
+ com.github.docker-java
+ docker-java
+ 1.3.1-SNAPSHOT
+
+## Documentation
-For additional examples, please look at [DockerClientTest.java](https://github.com/kpelykh/docker-java/blob/master/src/test/java/com/kpelykh/docker/client/test/DockerClientTest.java "DockerClientTest.java")
+For code examples, please look at the [Wiki](https://github.com/docker-java/docker-java/wiki) or [Test cases](https://github.com/docker-java/docker-java/tree/master/src/test/java/com/github/dockerjava/core/command "Test cases")
## Configuration
There are a couple of configuration items, all of which have sensible defaults:
-* `url` The Docker URL, e.g. `http://localhost:4243`.
-* `version` The API version, e.g. `1.11`.
-* `username` Your repository username (required to push containers).
-* `password` Your repository password.
-* `email` Your repository email.
+* `url` The Docker URL, e.g. `https://localhost:2376` or `unix:///var/run/docker.sock`
+* `version` The API version, e.g. `1.16`.
+* `username` Your registry username (required to push containers).
+* `password` Your registry password.
+* `email` Your registry email.
+* `serverAddress` Your registry's address.
+* `dockerCertPath` Path to the docker certs.
There are three ways to configure, in descending order of precedence:
-##### Programatic:
+#### Programmatic:
In your application, e.g.
- DockerClient docker = new DockerClient("http://localhost:4243");
- docker.setCredentials("dockeruser", "ilovedocker", "dockeruser@github.com");`
+ DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder()
+ .withVersion("1.16")
+ .withUri("https://my-docker-host.tld:2376")
+ .withUsername("dockeruser")
+ .withPassword("ilovedocker")
+ .withEmail("dockeruser@github.com")
+ .withServerAddress("https://index.docker.io/v1/")
+ .withDockerCertPath("/home/user/.docker")
+ .build();
+ DockerClient docker = DockerClientBuilder.getInstance(config).build();
+
+#### Properties
+
+ docker.io.url=https://localhost:2376
+ docker.io.version=1.16
+ docker.io.username=dockeruser
+ docker.io.password=ilovedocker
+ docker.io.email=dockeruser@github.com
+ docker.io.serverAddress=https://index.docker.io/v1/
+ docker.io.dockerCertPath=/home/user/.docker
+
##### System Properties:
-E.g.
- java -Ddocker.io.username=kpelykh pkg.Main
+ java -Ddocker.io.username=dockeruser pkg.Main
-##### File System
-In `$HOME/.docker.io.properties`, e.g.:
+##### System Environment
- docker.io.username=dockeruser
+ export DOCKER_URL=http://localhost:2376
+
+Note: we also auto-detect defaults. If you use `DOCKER_HOST` we use that value, and if `DOCKER_CERT_PATH` or `DOCKER_TLS_VERIFY=1` is set, we switch to SSL.
+
+##### File System
+
+In `$HOME/.docker.io.properties`
##### Class Path
-In the class path at `/docker.io.properties`, e.g.:
- docker.io.url=http://localhost:4243
- docker.io.version=1.11
+In the class path at `/docker.io.properties`
+
diff --git a/circle.md b/circle.md
new file mode 100644
index 00000000..d2d671d8
--- /dev/null
+++ b/circle.md
@@ -0,0 +1,51 @@
+# docker-java on circleCI
+
+The build including tests and integration tests can be automatically run on [circleCI](https://circleci.com/).
+
+## Setup
+1. create an account on circle CI using your github account.
+2. select docker-java from the github projects listed in your profile.
+3. go to the project settings for docker-java (click on the gear-wheel icon beside the docker-java title).
+4. open the *Environment variable* page.
+5. add the following environment variables:
+ - DOCKER_EMAIL
+ - DOCKER_PASSWORD
+ - DOCKER_USERNAME
+
+## Ignored Tests
+ExecCreateCmdImplTest.execCreateTest
+
+ - Exec is not supported by the lxc driver
+
+ExecStartCmdImplTest.execStartTest
+
+ - Exec is not supported by the lxc driver
+
+KillContainerCmdImplTest.killContainer
+
+ - Killed container has ExitCode 0
+
+ListImagesCmdImplTest.listDanglingImages
+
+ - caused by [docker#9939](https://github.com/docker/docker/issues/9939)
+
+RemoveContainerCmdImplTest.removeContainer
+
+ - caused by [docker#9939](https://github.com/docker/docker/issues/9939)
+
+RemoveImageCmdImplTest.removeImage
+
+ - caused by [docker#9939](https://github.com/docker/docker/issues/9939)
+
+ContainerDiffCmdImplTest.testContainerDiff
+
+ - too many diffs [{"Kind":0,"Path":"/dev"} ,{"Kind":1,"Path":"/dev/fuse"} ,{"Kind":1,"Path":"/dev/ptmx"} ,{"Kind":1,"Path":"/dev/tty"} ,{"Kind":1,"Path":"/dev/tty1"} ,{"Kind":1,"Path":"/dev/stdout"} ,{"Kind":1,"Path":"/dev/urandom"} ,{"Kind":1,"Path":"/dev/full"} ,{"Kind":1,"Path":"/dev/kmsg"} ,{"Kind":1,"Path":"/dev/null"} ,{"Kind":1,"Path":"/dev/stdin"} ,{"Kind":1,"Path":"/dev/stderr"} ,{"Kind":1,"Path":"/dev/zero"} ,{"Kind":1,"Path":"/dev/fd"} ,{"Kind":1,"Path":"/dev/random"} ,{"Kind":1,"Path":"/test"} ]
+
+BuildImageCmdImplTest.testDockerIgnore
+
+ - ignore is not working
+
+StopContainerCmdImplTest.testStopContainer
+
+ - Stopped container has ExitCode 0
+
diff --git a/circle.sh b/circle.sh
new file mode 100755
index 00000000..c84ca3fe
--- /dev/null
+++ b/circle.sh
@@ -0,0 +1,45 @@
+#!/bin/bash -ex
+
+case "$1" in
+ pre_machine)
+ # copy certificates to default directory ~/.docker
+ mkdir .docker
+ cp $CIRCLE_PROJECT_REPONAME/etc/certs/* .docker
+
+ # configure docker deamon to use SSL and provide the path to the certificates
+ docker_opts='DOCKER_OPTS="$DOCKER_OPTS -H tcp://127.0.0.1:2376 --tlsverify --tlscacert='$HOME'/.docker/ca.pem --tlscert='$HOME'/.docker/server-cert.pem --tlskey='$HOME'/.docker/server-key.pem"'
+ sudo sh -c "echo '$docker_opts' >> /etc/default/docker"
+
+ # debug output
+ cat /etc/default/docker
+ ls -la $HOME/.docker
+ ;;
+
+ post_machine)
+ # fix permissions on docker.log so it can be collected as an artifact
+ sudo chown ubuntu:ubuntu /var/log/upstart/docker.log
+
+ # validate that docker is working
+ docker version
+ ;;
+
+ dependencies)
+ mvn clean install -T 2 -Dmaven.javadoc.skip=true -DskipTests=true -B -V
+ ;;
+
+ test)
+ mvn clean verify
+ ;;
+
+ collect_artifacts)
+ # collect artifacts into the artifacts dir
+ cp target/*.jar $CIRCLE_ARTIFACTS
+ ;;
+
+ collect_test_reports)
+ mkdir -p $CIRCLE_TEST_REPORTS/surefire
+ mkdir -p $CIRCLE_TEST_REPORTS/failsafe
+ cp target/surefire-reports/TEST-*.xml $CIRCLE_TEST_REPORTS/surefire
+ cp target/failsafe-reports/TEST-*.xml $CIRCLE_TEST_REPORTS/failsafe
+ ;;
+esac
diff --git a/circle.yml b/circle.yml
new file mode 100644
index 00000000..d8a80371
--- /dev/null
+++ b/circle.yml
@@ -0,0 +1,28 @@
+dependencies:
+ override:
+ - ./circle.sh dependencies
+
+test:
+ override:
+ - ./circle.sh test
+ post:
+ - ./circle.sh collect_artifacts
+ - ./circle.sh collect_test_reports
+
+machine:
+ pre:
+ - ls -la docker-java
+ - $CIRCLE_PROJECT_REPONAME/circle.sh pre_machine
+ post:
+ - $CIRCLE_PROJECT_REPONAME/circle.sh post_machine
+ services:
+ - docker
+ environment:
+ MAVEN_OPTS: -Xmx128m
+ DOCKER_HOST: tcp://127.0.0.1:2376
+ DOCKER_CERT_PATH: $HOME/.docker
+ DOCKER_TLS_VERIFY: 1
+
+general:
+ artifacts:
+ - /var/log/upstart/docker.log
diff --git a/etc/certs/README.md b/etc/certs/README.md
new file mode 100644
index 00000000..165265a0
--- /dev/null
+++ b/etc/certs/README.md
@@ -0,0 +1,175 @@
+# Creating Certificates for Docker
+
+## Warning
+> These certificates are only meant for integration tests on CI environments (like circleCI). Do not use them for any real machine.
+> Since all keys are publicly available anybody could gain root access to your machine.
+
+### 1. Create the certificate files
+There is an [excellent guide](https://docs.docker.com/articles/https/) on the official docker homepage.
+This document contains the log on how the certificates in this folder were created.
+It differs slightly form the official guide.
+ - Certificates are valid for 10 years instead of 1 year.
+ - Certificates use v3_req extension to support both `127.0.0.1` and `localhost` (see config file [server-cert.txt](server-cert.txt)).
+
+```
+$ cd ~
+```
+
+```
+$ mkdir .docker
+```
+
+```
+$ cd .docker
+```
+
+```
+$ echo 01 > ca.srl
+```
+
+```
+$ openssl genrsa -des3 -out ca-key.pem 2048
+Generating RSA private key, 2048 bit long modulus
+............................................+++
+..................+++
+e is 65537 (0x10001)
+Enter pass phrase for ca-key.pem: docker-java
+Verifying - Enter pass phrase for ca-key.pem: docker-java
+```
+
+```
+$ openssl req -new -x509 -days 3650 -key ca-key.pem -out ca.pem
+Enter pass phrase for ca-key.pem: docker-java
+You are about to be asked to enter information that will be incorporated
+into your certificate request.
+What you are about to enter is what is called a Distinguished Name or a DN.
+There are quite a few fields but you can leave some blank
+For some fields there will be a default value,
+If you enter '.', the field will be left blank.
+-----
+Country Name (2 letter code) [AU]:
+State or Province Name (full name) [Some-State]:
+Locality Name (eg, city) []:
+Organization Name (eg, company) [Internet Widgits Pty Ltd]: docker-java
+Organizational Unit Name (eg, section) []:
+Common Name (e.g. server FQDN or YOUR name) []:
+Email Address []:
+```
+
+```
+$ openssl genrsa -des3 -out server-key.pem 2048
+Generating RSA private key, 2048 bit long modulus
+..........+++
+.........+++
+e is 65537 (0x10001)
+Enter pass phrase for server-key.pem: docker-java
+Verifying - Enter pass phrase for server-key.pem: docker-java
+```
+
+```
+$ openssl req -new -key server-key.pem -out server.csr -config server-cert.txt
+Enter pass phrase for server-key.pem: docker-java
+You are about to be asked to enter information that will be incorporated
+into your certificate request.
+What you are about to enter is what is called a Distinguished Name or a DN.
+There are quite a few fields but you can leave some blank
+For some fields there will be a default value,
+If you enter '.', the field will be left blank.
+-----
+TypeCommonNameHere []: localhost
+```
+
+```
+$ openssl x509 -req -days 3650 -in server.csr -CA ca.pem -CAkey ca-key.pem -out server-cert.pem -extensions v3_req -extfile server-cert.txt
+Signature ok
+subject=/CN=localhost
+Getting CA Private Key
+Enter pass phrase for ca-key.pem: docker-java
+```
+
+```
+$ openssl genrsa -des3 -out key.pem 2048
+Generating RSA private key, 2048 bit long modulus
+............................................+++
+.......................................................+++
+e is 65537 (0x10001)
+Enter pass phrase for key.pem: docker-java
+Verifying - Enter pass phrase for key.pem: docker-java
+```
+
+```
+$ openssl req -subj '/CN=client' -new -key key.pem -out client.csr
+Enter pass phrase for key.pem: docker-java
+```
+
+```
+$ echo extendedKeyUsage = clientAuth > extfile.cnf
+```
+
+```
+$ openssl x509 -req -days 3650 -in client.csr -CA ca.pem -CAkey ca-key.pem -out cert.pem -extfile extfile.cnf
+Signature ok
+subject=/CN=client
+Getting CA Private Key
+Enter pass phrase for ca-key.pem: docker-java
+```
+
+```
+$ openssl rsa -in server-key.pem -out server-key.pem
+Enter pass phrase for server-key.pem: docker-java
+writing RSA key
+```
+
+```
+$ openssl rsa -in key.pem -out key.pem
+Enter pass phrase for key.pem: docker-java
+writing RSA key
+```
+
+Once you created all the files you can have a look at their content with the following command
+
+```
+openssl x509 -in .pem -inform pem -noout -text
+```
+
+### 2. Configuring the docker daemon
+On linux the docker daemon allows to specify options in the file `/etc/default/docker`.
+By adding the following line (or modifying an existing line) one can get the docker daemon to listen on both *unix socket* and *https*.
+```
+DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://127.0.0.1:2376 --tlsverify --tlscacert=~/.docker/ca.pem --tlscert=~/.docker/server-cert.pem --tlskey=~/.docker/server-key.pem"
+```
+
+### 3. Restart the daemon and test the setup
+After changing the daemon options it must be restarted
+
+```
+$ sudo service docker restart
+```
+
+To test the socket and the https connection:
+
+```
+$ docker -H tcp://127.0.0.1:2376 --tlsverify version
+Client version: 1.4.1
+Client API version: 1.16
+Go version (client): go1.3.3
+Git commit (client): 5bc2ff8
+OS/Arch (client): linux/amd64
+Server version: 1.4.1
+Server API version: 1.16
+Go version (server): go1.3.3
+Git commit (server): 5bc2ff8
+```
+
+```
+$ docker -H unix:///var/run/docker.sock version
+Client version: 1.4.1
+Client API version: 1.16
+Go version (client): go1.3.3
+Git commit (client): 5bc2ff8
+OS/Arch (client): linux/amd64
+Server version: 1.4.1
+Server API version: 1.16
+Go version (server): go1.3.3
+Git commit (server): 5bc2ff8
+```
diff --git a/etc/certs/ca-key.pem b/etc/certs/ca-key.pem
new file mode 100644
index 00000000..bf1b0e2d
--- /dev/null
+++ b/etc/certs/ca-key.pem
@@ -0,0 +1,30 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,A5E7732EBEA97F20
+
+/KgdVVIFc++tLxcot9FCziUqi6uZMk2pFy676Vh9ZILuHE5t8WZ66sn+aXjsNb0T
+L9Z67+Yx9E3Y7L2wl/NwwpYZctt9XWo8wR1fVucYf98PEbRWXlbS1GYK3bMtYPeU
+iGxLOK/WU3uqItH9g2uxCeXf+wjP14kiFrzrrd1XrShxTUs/bqIbHd7+GJetgvpS
+5UKXiISLUf+5EwuODVhe6zYg80P616HuitkKDekAM7PZz6YsVIhPNnxOlSIEIylS
+sPK71Aiy6yu57Qp6Jm1E1JsPVcoEOAEtAUlMxxyVNhj5fQ35lX/OkkhJGXmKXfIl
+U6YVBreAwSeuwv7ochmyIsoOHzw5QJGlm8ycMYaxrceh7J3cGT0+04WgLi9+ieZ/
+AseXPryryqhIgR4qN0/9vAnA++N+YtelzhIeXqJhtpMEc5yb7po/OJejMboFJyAa
+5P4IvCXohfSVSMBwaB2Vh9xA+2d34hQS5AKFkzlfbMJU81HmCUh70CKYJ9PGSdh4
+itkSoc9iQ2e0RxOxhJSqjpYYbKcxL2PTkMTpxqDGiJQ8FfLWuDhpz5mUWSvt3a41
+zbypHsKntibKP8Ceem1vckIid0mnWaZolbOcHBzErsa/3BvO5ZP3q7HTf35yyy7o
+VO1LXQqO8trYnkG2PiXk0eWUzTVgiGQYFoGdAdFOkF95y2LBRcgyBhQTfxIbqMW3
+Nr2wkSHU0JT1NLI0UKhVAB7/uLJKwGgLcYU9j4DAA4rT8sZF9zbdjLuSFx5dnV+h
+g8H+QOKbvmGpvTIeDrxwSpgzu7mqmPcpf1gFHBTdYCV8QXF4u96VZlar6dnoYoVj
+OdS96HYxC2gsrDJJ5Nls0deTWqdKxbnDRXs4Vu7yTO1B/nMnSgptksOoVq50SD1a
+IrtA4d6aZzfr1U647nWXTdaeDJ2acq4u8fM8JZNbMj0/Y7HJa3BQz+55yCQb+iFE
+1VOzm1D9xcU8NCBgquT4C6FcPIQQpyq50B7lez8SEyAvqPnoMlqAulF6qo+0ZtZC
+MaS+C2dlNUUjVOV7qDsracSY6esf5WF40nc1jzNflV+Pwqk7ISDkv4GiiH+yXq8t
+hrP2sAiWHd2oHw1RCoEW7UgWAyW72wAOFTwnvQBCkVmxk/kBgrNDU+8SBmClqSod
+CEWOcb6apore20xXmhq8mEddW2Xjk+U1dLRkBBp5oaopbYQ25LO+PZIpIJr1mcCi
+6D42EHmCGQovkaL4G40IhXDrU98u2J72be8i/B7sQ8s3A5d7CwJwICG5PoiM7MJU
+dfwWPmpKVAt38PQ4fWmZjw3pUnU2qyXGUc5TV6J8ZhU5yFvx4P7n7/Zd1QaZ34ar
+A3XcHoAidu8O/C1N/bdSttJHniirTIYYgiqVTtjT66qALSeDCab3JT9C7Zfxr39+
+YamKTXu+dMw7C91Cg9ETiNcNvNsjVK1cMVmcwirJjSlK1Wr1cRbFkWg55uVSuO52
+r08qGAHge9gekW1Rcc/RKp0qv193PYCYMzKUoW28MEspHPbs84fhGIiK8v/OF9Pg
+nu0T8r+Xzr2a7TSSTsO77WTjXrEfgjrddfUhsIiSNWVePL86iNkZoB5QrWH7DgKW
+-----END RSA PRIVATE KEY-----
diff --git a/etc/certs/ca.pem b/etc/certs/ca.pem
new file mode 100644
index 00000000..0cf1b2b9
--- /dev/null
+++ b/etc/certs/ca.pem
@@ -0,0 +1,20 @@
+-----BEGIN CERTIFICATE-----
+MIIDQzCCAiugAwIBAgIJAN94VLe4RxmkMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMRQwEgYDVQQKDAtkb2NrZXItamF2
+YTAeFw0xNTAxMjAyMTE5MzBaFw0yNTAxMTcyMTE5MzBaMDgxCzAJBgNVBAYTAkFV
+MRMwEQYDVQQIDApTb21lLVN0YXRlMRQwEgYDVQQKDAtkb2NrZXItamF2YTCCASIw
+DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANiZy9f+AHejo9s9Ve1WwXQeKR28
+s2SbSpf82+kMtLHL0/r0HIDwhA9uOSglqpFY21vVWFYGY+Mh8Z4bgoyUOFIM/WQn
+fgS2trYjfRZuZeR8u57dVyqLyzMV7eWdPBbnU1rTavwvsQMwWWwKF+AXhKpUoDtT
+N+gQyqTQYdEsyhQS/HzC7fH3QC0deSrUS5yjX9qIEr3dZwE93BK2wqUFEy9JvyQ5
+DIh5N6HpRKzFcH/zHd/GPeXXnWKVCO5plDn/XTv85a5PesyFV2Zi//0g3UWgpzFC
+2sTh5Brj7kamlVbOLBpQTV2LFY38c3MNYbiNTzKtkAQgVtHA4YS5ym3z8PcCAwEA
+AaNQME4wHQYDVR0OBBYEFJME9p4vpy900Ryw/E/Mz750ZK9xMB8GA1UdIwQYMBaA
+FJME9p4vpy900Ryw/E/Mz750ZK9xMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEL
+BQADggEBANZPR1572nkOKEsxZkV1jou64NqZLGGVjXEdjJP56R5G8cyoBoZfqiT0
+J2/IxU7UZ5n65C79FLeLnAq/0GuWw07BREzAZjBZmBOe3Ma3qZi47MESIEEJ06XL
+g4/rGFbeDlV9otVhKQ27U//4qodLUNzZBq+VrQNUfSk8vqEb0iGKHSSLTV6DZx8w
+Yb79ZFA53+LOloKKbrGQsSKshSDUxnl+19jVXMUgvvrcyEE20I30wB0ZVE5pPME7
+tAqBFjqe+SR+gxwVXrpRSPhjZfqDhSOvsbZwuJqNVqE1sVnZCbwcnvIGGRu8TWej
+JARvyGHOlwoE3kVH+4VKeYQ7PcL5wck=
+-----END CERTIFICATE-----
diff --git a/etc/certs/ca.srl b/etc/certs/ca.srl
new file mode 100644
index 00000000..75016ea3
--- /dev/null
+++ b/etc/certs/ca.srl
@@ -0,0 +1 @@
+03
diff --git a/etc/certs/cert.pem b/etc/certs/cert.pem
new file mode 100644
index 00000000..7063ef99
--- /dev/null
+++ b/etc/certs/cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC2zCCAcOgAwIBAgIBAzANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQGEwJBVTET
+MBEGA1UECAwKU29tZS1TdGF0ZTEUMBIGA1UECgwLZG9ja2VyLWphdmEwHhcNMTUw
+MTIwMjEzNjIzWhcNMjUwMTE3MjEzNjIzWjARMQ8wDQYDVQQDDAZjbGllbnQwggEi
+MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZlY8JUY4VqGyi/h9b0WHvqjgt
+y+nyQd9vdgY6IvjsLDcl0fjp4knFxSpl1U0oLA1JnElT3Qgv1zv4GYvc/DUbld7d
+5B1jQzOYbUWgOzRa/903wpEXn9waBU2mwtyObzmXvmZ6XUA+fgx3EFnimflzEkjm
+vYskH2lW0pbbt4/3cCeD282DEmmzaOOkFR8agV6aE4T/x+BRFkVgR1T8Dfiu6Yyy
+CJ57OO7kcCGoAPIEe3dGi5UGQVKuDjlohZKApg6E2ISINVvbxsHqKkGU9lNRqxkg
+P6qV8LAhypo5sEqeAvlnIgOrhpb0c+zzoqgV0d+s2gU2GVa6SvT0OcidwyzjAgMB
+AAGjFzAVMBMGA1UdJQQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBCwUAA4IBAQCL
+2T/pu5weRuXcPEvBvmyOfEZZp0bzfGw0DYsp5XKARV7M6qJPPTpjqLm3AbjPqsv2
+fn0GQq8hWThveJhYps6mnhAsYC5rlfxFH+JC2i1EfhTIjWCP7WKdjXJr6hmhrVNc
+7cxyQjWh/vSAk4nRcH3fNLUF1HNhZBuB1aOniTWTeoTgd7sIQjVpX4V6avOEcSGo
+mylt3fqHO5X/CONFJnvv0SHFOCGr9WX/9Sq0GlpHoEK80gBVQt/O22U1PGZ2kYaT
+Z/Fs2r85ltC/POPTCyQ3oKk4j2YF7HwJhJ2gP8jwKl4aX1iypwpCa/d9hvCFn8Wh
+bEv9E557EH9PjLyqlnwi
+-----END CERTIFICATE-----
diff --git a/etc/certs/client.csr b/etc/certs/client.csr
new file mode 100644
index 00000000..44748724
--- /dev/null
+++ b/etc/certs/client.csr
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICVjCCAT4CAQAwETEPMA0GA1UEAwwGY2xpZW50MIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEA2ZWPCVGOFahsov4fW9Fh76o4Lcvp8kHfb3YGOiL47Cw3
+JdH46eJJxcUqZdVNKCwNSZxJU90IL9c7+BmL3Pw1G5Xe3eQdY0MzmG1FoDs0Wv/d
+N8KRF5/cGgVNpsLcjm85l75mel1APn4MdxBZ4pn5cxJI5r2LJB9pVtKW27eP93An
+g9vNgxJps2jjpBUfGoFemhOE/8fgURZFYEdU/A34rumMsgieezju5HAhqADyBHt3
+RouVBkFSrg45aIWSgKYOhNiEiDVb28bB6ipBlPZTUasZID+qlfCwIcqaObBKngL5
+ZyIDq4aW9HPs86KoFdHfrNoFNhlWukr09DnIncMs4wIDAQABoAAwDQYJKoZIhvcN
+AQELBQADggEBAJ+IARXkgVRRj2sARH4D+1cwD5WSZwlTr5dsB5myGlNx7crNrWeu
+Rqhu2r3xh8b5FlIbggC+aR8U5ikeBHfiRYXV3lt41+AKriKqNR348AAw/WLWPEDG
+V6WWieVyicTdN2yMH3tWcisIsqTiVGWDcagVhRmAPP0VBdQ8OyTJCIjIiOhG0LDg
+LlEiFuO7npc5ywXJjfh4TjFsyfSjTJv3UYY7zWYgfalWit9OeDbMhgGOwOwOFyDj
+lOpQKeBxDwhnH5DC90OmbjK4FkMbQhrTXvURfUts/wz2SLqkQVB8FWuVc0RwUhnX
+s2KWbehobjOpK3WkOgDfLGY72HnhU5IbP9Q=
+-----END CERTIFICATE REQUEST-----
diff --git a/etc/certs/extfile.cnf b/etc/certs/extfile.cnf
new file mode 100644
index 00000000..74dedb38
--- /dev/null
+++ b/etc/certs/extfile.cnf
@@ -0,0 +1 @@
+extendedKeyUsage = clientAuth
diff --git a/etc/certs/key.pem b/etc/certs/key.pem
new file mode 100644
index 00000000..4319223e
--- /dev/null
+++ b/etc/certs/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEA2ZWPCVGOFahsov4fW9Fh76o4Lcvp8kHfb3YGOiL47Cw3JdH4
+6eJJxcUqZdVNKCwNSZxJU90IL9c7+BmL3Pw1G5Xe3eQdY0MzmG1FoDs0Wv/dN8KR
+F5/cGgVNpsLcjm85l75mel1APn4MdxBZ4pn5cxJI5r2LJB9pVtKW27eP93Ang9vN
+gxJps2jjpBUfGoFemhOE/8fgURZFYEdU/A34rumMsgieezju5HAhqADyBHt3RouV
+BkFSrg45aIWSgKYOhNiEiDVb28bB6ipBlPZTUasZID+qlfCwIcqaObBKngL5ZyID
+q4aW9HPs86KoFdHfrNoFNhlWukr09DnIncMs4wIDAQABAoIBAAT2o2+r+5jE4c2K
+DH8UtK457NQmnayYEhfB0nyLBbClhZCITKxRLCulxsTR69OpxZfTR9zw4tnsiAKt
+2oHtAu0hKxdWt9Dm3Itymq8ACr60rYAzIQov7F5vlojiUxOwt9idUEskS23hhDlH
+FzXTG1yjoyQYWM83JDkFzskuU8tqKcdZUGHxwDqWaLpCJRCqaXGBbwBsiBE0WpD4
+U2Iq32Cbcf2KK/iI2CpEhEVSLZAHuh1Ovv4l2kb3PSFV1x4zSOJjHO6LM+4nAgmx
+1XcVH+Qpw7oRoRpEajBss6XlIvRRohhXRlzUDi5T6smkoo69pXn1OFaav6U8BwVN
+2nIrnJECgYEA8Wn9OBnxgJvVji+Wdc92IoHgSB8Y/xPuI4a2go84AHd0Ek7GzE6g
+o52eq1v+7+Uj2y/xTIvcGEfOz8/oeOzWJqsLpi34CeqhewwWHNogAD2Xg6DpCHmc
+ARzKKod9djwU0y5+/8YBsfpSM6ZKzbnP5HzblA+oIllAY50VJvp+HhsCgYEA5rr8
+8EsjnuNo+/RuVp4vATP2ML6D/ILHQEZR6tPgfjaiEZfMm22yX6J8F/kNVHO2c1Pt
+94A+dKa3QyQBieb27u1+N0iUOkAYvnExkaazkVwOH4sXwn4EzxGFTdwwSW5Uenl4
+8Qry08mnnJwKP38TlNrw3Q9PbZNFFlXLdaAteNkCgYEAjhmFI3Ch5sHTgk4gklf7
+gXRRQCKN5BcnJWI2K8OBg0TM3bng6oGdrLEqpFMSTMLjyDEAJ75rXx9lbI1EmWlO
+5JPp13dXeP7S7kq++VyrWXjnpmMgyAxM95qqpT37a40R9Px5ZLR4avqdSCmp/k5R
+QHz+Arj0jsNaU0gzGy527eECgYEAu1Mk+JKIoP9QxP52dqyGzRs6zehfkCs9SdnN
+uDG9GbuRaWctHyO4phxtU6lIQUCQ6KFDmqXsDxkrwL8C4Ms7wE/hIVEzxvczH6sW
+64HEWEe8z69F4wodLWC0MbqLGZMR0z28CzcwXvJhuqyVRWgOpdP7qf48JmJivPd6
+8EzTnkECgYA5x137xZgFZGYOdRF4yCLkbZ8weDKbcTotUgNSFR2xMYzytzWmEg5D
+rvjhGXmhqvxNTzEJehWVVJoQHFW0aJhC7ML2VP56DQ7p2gM75HrojZpdoUzwF73T
++E6W/Nddm6N8tuQ/q/rIrsgF6/FJ9H5D9ZeK69En3QwC4xUgHlWQGA==
+-----END RSA PRIVATE KEY-----
diff --git a/etc/certs/server-cert.pem b/etc/certs/server-cert.pem
new file mode 100644
index 00000000..1edc7b79
--- /dev/null
+++ b/etc/certs/server-cert.pem
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC5TCCAc2gAwIBAgIBAjANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQGEwJBVTET
+MBEGA1UECAwKU29tZS1TdGF0ZTEUMBIGA1UECgwLZG9ja2VyLWphdmEwHhcNMTUw
+MTIwMjEzMTQ4WhcNMjUwMTE3MjEzMTQ4WjAUMRIwEAYDVQQDEwlsb2NhbGhvc3Qw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDECxOHu9oVQX2IGivToPdC
+gcVcewBOQJClLDmnGdfP99gtBdNaa59cXnPudd+r24lfnIs98XUbAWZoYFYTmj1s
+jukyL1jwH2zcPVmcTKWz6zTbComxaNQJRHZGPIeR1qJIiJHIMa0Xt9y0w/SH0qHw
+Ts69PkRCILaUGRhsms5qYJ91fsRzYO4jXYR3F0vEEoUzhlI7qw4n3QaTOVbZ154v
+3VEvlrECCLVpE4KUcccgenNNoEeqTdkiAe4ywupHjkzo3ThcWSfv+a+oRRmQlhsD
+BPL2RxyNiu2NvML6WyMPKQNvyV7s6kyDKmpbLg3Y0QV/VhneZ90+bPG/VslpMPzb
+AgMBAAGjHjAcMBoGA1UdEQQTMBGHBH8AAAGCCWxvY2FsaG9zdDANBgkqhkiG9w0B
+AQsFAAOCAQEAInNXInEzAA9AbEOsNXKyAXHJQWCUK6+tCQkxNIiGKaRWtEYLmrpx
+1xx7xTACZihpK+vRyG4MUNkHIoVqNi/Jg4Z0cJq3lU3FnCpU0TUY2avj8iWbn2Ke
+B5SFnPyi2JSZhw8ZsssA6/cs7EoTbQYSi1CO7SoKXj8RvQJcYWc8dx3Ydkq05pIT
+e897LxrHjrpiGK+a+2ghw9amfnXmElYneKP5WrpZcIiHAD3Fp6ecvYkLGLf1G5D/
+bjjMUfbsYMjeZFVG6wzTJ8tBDeJkovpb2vPpuLM+raYkqGDiUBD2Kqgyq1uL6ZLc
+PYmsXVGiosG7QpVxDsaYy8DQa/4FeQWC1g==
+-----END CERTIFICATE-----
diff --git a/etc/certs/server-cert.txt b/etc/certs/server-cert.txt
new file mode 100644
index 00000000..4ce34a14
--- /dev/null
+++ b/etc/certs/server-cert.txt
@@ -0,0 +1,13 @@
+[req]
+distinguished_name = req_distinguished_name
+req_extensions = v3_req
+
+[req_distinguished_name]
+commonName = TypeCommonNameHere
+
+[v3_req]
+subjectAltName = @alt_names
+
+[alt_names]
+IP.1 = 127.0.0.1
+DNS.1 = localhost
diff --git a/etc/certs/server-key.pem b/etc/certs/server-key.pem
new file mode 100644
index 00000000..7490cbcb
--- /dev/null
+++ b/etc/certs/server-key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAxAsTh7vaFUF9iBor06D3QoHFXHsATkCQpSw5pxnXz/fYLQXT
+WmufXF5z7nXfq9uJX5yLPfF1GwFmaGBWE5o9bI7pMi9Y8B9s3D1ZnEyls+s02wqJ
+sWjUCUR2RjyHkdaiSIiRyDGtF7fctMP0h9Kh8E7OvT5EQiC2lBkYbJrOamCfdX7E
+c2DuI12EdxdLxBKFM4ZSO6sOJ90GkzlW2deeL91RL5axAgi1aROClHHHIHpzTaBH
+qk3ZIgHuMsLqR45M6N04XFkn7/mvqEUZkJYbAwTy9kccjYrtjbzC+lsjDykDb8le
+7OpMgypqWy4N2NEFf1YZ3mfdPmzxv1bJaTD82wIDAQABAoIBAEpDT+CpHpHSvzTh
+hRyj60Z8VkEULyd1edW4DRbpyUD0yCU2AbxM7I9XEF+Ss2osvbtEV9LdNtlGDH8Z
+j0HZuc73zArAuNYtcVV0wA9fUZ34SYt4UHSuGzRvhMZSg6CRR+RmJ6NIfiNv+OFZ
+IbaZ6dJYaCR0A/Nw5PjxELmDYxIUYcXKZAwjVP+GLvOmjE/xSD1kwEVeIzmtgEeX
+UixqI8KgDpASuf0N21fJ67pcAIohrmsWzjeSXMFINFCMuUuqAKCuPpUthybHjMy/
+7vjEI7ViEcpcHd7IW5h+RTl3r4hnQaNbbbcwGWmc+8u7qOcPJe6cEBXD8ud6dZUz
+wdLdRwECgYEA8z9Vw/Ms2NQwQA4FUcnoQQ4pnK5bJIPLAa7MaomEYfVciMU1oWcI
+4gspTelHSSY4+D/AlyLD5FgDpi0YfeYQJjcZVs2m/5mZn5BFqQKAmmMWtBxo6RSO
+VF6SyfNsqpQTsFY0dp9HKCDVo0mtTKFizLBDrmSCroGv3fb6KodH25sCgYEAzlI0
+3Lan70ABn3cO4iGfQvvrUw2A/ZX01lVtDJzq8LJ+IXy9zev4C+ZOUT/8/L/D4K3W
+hO1px7WrUSaMr5F9scXC0PYfMNoMn9YzfxEYCMQA5dCWnUhf6t2ESUFeh1Qt3b7j
+kz7U2/pSk7VXithwITKKEgicG0EBABHuyio0l8ECgYEAjF90YwwmSUrKPWzZ7QUT
+ntdJdD26IyxbLrFtDd4mI1GxAMyt0mLfYXMHdwq0NKZ2IezIe294lIGmOXO0upLV
+pvgNC2bKhJ5jZQ2g5ZOoG3ArXe03LarLKC0bkKeFgjrJ0e0tgXcRXTr1jrGp7JsF
+pRHjPPSL5aC5mOI6I+jFsxkCgYAV6uG2uKiqX9BMUmeAWjYC9aQQFJUpWy7BPh3x
+gxHqM+v2PrwjDfgxu2uCchu79dsnGRB62oWsM35ZhpDXbcs+gVWqwRqbI+7HZAfg
+bb5x3/CAeWImnzOhTZrp9UnHcofU0Jx4Xepa3AK9sjv0gf2XaTkFpWh/9K3Yhg8p
+5sXjgQKBgGv3a1VpQ0YG3PoN7l8Pjzg6/IYslxUkZwdyUqeTJD3hRDbQybXIhJGw
+0GbAkxTkXwFFQpRplCj5wk6U0M/JZRW3IhiuHovmZd/WSvl3EgzLT/5U3kYE3K6V
+ZH1Hgs1SCQhQXIWm/QerI1KlNg4PKhctPohSc1ttW3hQUBh1reTR
+-----END RSA PRIVATE KEY-----
diff --git a/etc/certs/server.csr b/etc/certs/server.csr
new file mode 100644
index 00000000..f4fc6d38
--- /dev/null
+++ b/etc/certs/server.csr
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIChjCCAW4CAQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0B
+AQEFAAOCAQ8AMIIBCgKCAQEAxAsTh7vaFUF9iBor06D3QoHFXHsATkCQpSw5pxnX
+z/fYLQXTWmufXF5z7nXfq9uJX5yLPfF1GwFmaGBWE5o9bI7pMi9Y8B9s3D1ZnEyl
+s+s02wqJsWjUCUR2RjyHkdaiSIiRyDGtF7fctMP0h9Kh8E7OvT5EQiC2lBkYbJrO
+amCfdX7Ec2DuI12EdxdLxBKFM4ZSO6sOJ90GkzlW2deeL91RL5axAgi1aROClHHH
+IHpzTaBHqk3ZIgHuMsLqR45M6N04XFkn7/mvqEUZkJYbAwTy9kccjYrtjbzC+lsj
+DykDb8le7OpMgypqWy4N2NEFf1YZ3mfdPmzxv1bJaTD82wIDAQABoC0wKwYJKoZI
+hvcNAQkOMR4wHDAaBgNVHREEEzARhwR/AAABgglsb2NhbGhvc3QwDQYJKoZIhvcN
+AQELBQADggEBAGaf5ZlZMuUmLzdyWQEm90YPu9jpqrFocu2GUmHLEuW23/p3JRHX
+gljn8VJkHaaAtP8gqPnk6Fn2BZJZrqVsjg+KoLxHuKUC0K2ZdYoFBl4usmfpQqe9
+3F0qUvScHaqdxff6OKORD1hXqCYF6V1WGwb2cTSbYr1xy/ehK+VhhPd+zTaQg0Es
+CcacEJTYd61gIsW2FD0XkokUUokNLj0FL9dt2ANgaefJPKBH/Pp/2hTiXEhEjIm6
+MkQVjnMbx/5/5k48yhpwPEl0FdiyLQdbzT03sHbrDKCeAdOJgOibZUnJYCJ8/1vu
+AH28ajlCUMvKsUE+mtDU/VYvci758n5CiYc=
+-----END CERTIFICATE REQUEST-----
diff --git a/pom.xml b/pom.xml
index 3de239d1..f8eb34ce 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,305 +1,393 @@
-
- 4.0.0
-
-
- org.sonatype.oss
- oss-parent
- 7
-
-
- com.kpelykh
- docker-java
- jar
- 0.8.2-SNAPSHOT
-
- docker-java
- https://github.com/kpelykh/docker-java
- Java API Client for Docker
-
-
-
- The Apache Software License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
- repo
-
-
-
-
- scm:git:git@github.com:kpelykh/docker-java.git
- git@github.com:kpelykh/docker-java.git
- scm:git:git@github.com:kpelykh/docker-java.git
-
-
-
-
- kpelykh
- Konstantin Pelykh
- kpelykh@gmail.com
-
-
-
-
- true
-
- UTF-8
- true
- false
- 1.6
- 1.6
-
- 1.6.1
-
- 1.18
- 1.9
-
- 2.3.3
-
- 4.2.5
- 1.5
- 2.3
- 2.6
- 1.7.5
- 1.3.9
- 0.3
-
-
- 1.0.1
- 5.12.1
- 1.3
- 1.6
- 2.3.3
-
-
- 2.2
- 2.3.1
- 2.3.1
- 2.8.1
- 2.5.1
- 1.7
-
-
-
-
- com.fasterxml.jackson.jaxrs
- jackson-jaxrs-json-provider
- ${jackson-jaxrs.version}
-
-
- com.sun.jersey
- jersey-core
- ${jersey.version}
-
-
- com.sun.jersey
- jersey-client
- ${jersey.version}
-
-
-
- com.sun.jersey.contribs
- jersey-multipart
- ${jersey.version}
-
-
- com.sun.jersey.contribs
- jersey-apache-client4
- ${jersey-apache-client4.version}
-
-
-
- org.apache.httpcomponents
- httpclient
- ${httpclient.version}
-
-
-
- org.apache.commons
- commons-compress
- ${commons-compress.version}
-
-
- commons-lang
- commons-lang
- ${commons-lang.version}
-
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
-
- com.github.jnr
- jnr-unixsocket
- ${jnr.unixsocket.version}
-
-
-
- org.slf4j
- slf4j-api
- ${slf4j-api.version}
-
-
-
- org.slf4j
- jul-to-slf4j
- ${slf4j-api.version}
-
-
-
-
- ch.qos.logback
- logback-core
- ${version.logback}
- test
-
-
-
- ch.qos.logback
- logback-classic
- ${version.logback}
- test
-
-
-
- org.testng
- testng
- ${version.testng}
- test
-
-
-
- org.hamcrest
- hamcrest-library
- ${hamcrest.library.version}
- test
-
-
-
- com.googlecode.lambdaj
- lambdaj
- ${lambdaj.version}
- test
-
-
- org.hamcrest
- hamcrest-all
-
-
-
-
-
- org.testinfected.hamcrest-matchers
- jpa-matchers
- ${hamcrest.jpa-matchers}
- test
-
-
-
-
-
- com.github.jnr
- jffi
- 1.2.7
-
-
- com.github.jnr
- jffi
- native
- 1.2.7
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- ${maven-release-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- ${jdk.source}
- ${jdk.target}
- ISO-8859-1
- ${jdk.debug}
- ${jdk.optimize}
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- ${maven-jar-plugin.version}
-
-
-
- test-jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire-plugin.version}
-
- ${skipTests}
-
-
-
-
-
- org.codehaus.mojo
- cobertura-maven-plugin
- ${cobertura-maven-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
- ${maven-antrun-plugin.version}
-
-
- validate
-
- run
-
-
-
- *******************************************************************
- *******************************************************************
- [project.name] : ${project.name}
- [project.basedir] : ${project.basedir}
- [project.version] : ${project.version}
- [project.artifactId] ${project.artifactId}
- [project.build.directory] ${project.build.directory}
- [jdk.source] : ${jdk.source}
- [jdk.target] : ${jdk.target}
- [jdk.debug] : ${jdk.debug}
- [jdk.optimize] : ${jdk.optimize}
- [source encoding]: ${project.build.sourceEncoding}
- [LocalRepository] : ${settings.localRepository}
- *******************************************************************
- *******************************************************************
-
-
-
-
-
-
-
-
-
+
+ 4.0.0
+
+
+ org.sonatype.oss
+ oss-parent
+ 9
+
+
+ com.github.docker-java
+ docker-java
+ jar
+ 1.3.1-SNAPSHOT
+
+ docker-java
+ https://github.com/docker-java/docker-java
+ Java API Client for Docker
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ scm:git:git@github.com:docker-java/docker-java.git
+ git@github.com:docker-java/docker-java.git
+ scm:git:git@github.com:docker-java/docker-java.git
+ HEAD
+
+
+
+
+ kpelykh
+ Konstantin Pelykh
+ kpelykh@gmail.com
+
+
+
+
+ UTF-8
+ UTF-8
+ true
+ false
+ 1.7
+ 1.7
+
+ 2.11
+ 2.1.2
+ 4.3.1
+ 1.5
+ 1.8
+ 2.3
+ 2.6
+ 1.7.5
+
+ 1.51
+ 2015-01-27T15-02-14
+ 18.0
+
+
+ 1.1.0
+ 5.12.1
+ 1.3
+ 1.6
+ 2.3.3
+
+
+ 2.2
+ 2.3.1
+ 2.3.1
+ 2.17
+ 2.17
+ 2.5.1
+ 1.7
+
+
+
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+ ${jackson-jaxrs.version}
+
+
+ org.glassfish.jersey.connectors
+ jersey-apache-connector
+ ${jersey.version}
+
+
+ org.apache.httpcomponents
+ httpclient
+ ${httpclient.version}
+
+
+ org.glassfish.jersey.core
+ jersey-client
+ ${jersey.version}
+
+
+ de.gesellix
+ unix-socket-factory
+ ${unix-socket-factory.version}
+
+
+
+ org.apache.commons
+ commons-compress
+ ${commons-compress.version}
+
+
+ commons-codec
+ commons-codec
+ ${commons-codec.version}
+
+
+ commons-lang
+ commons-lang
+ ${commons-lang.version}
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j-api.version}
+
+
+ com.google.guava
+ guava
+ ${guava.version}
+
+
+ org.bouncycastle
+ bcpkix-jdk15on
+ ${bouncycastle.version}
+
+
+
+
+ ch.qos.logback
+ logback-core
+ ${logback.version}
+ test
+
+
+
+ ch.qos.logback
+ logback-classic
+ ${logback.version}
+ test
+
+
+
+ org.testng
+ testng
+ ${testng.version}
+ test
+
+
+
+ org.hamcrest
+ hamcrest-library
+ ${hamcrest.library.version}
+ test
+
+
+
+ com.googlecode.lambdaj
+ lambdaj
+ ${lambdaj.version}
+ test
+
+
+ org.hamcrest
+ hamcrest-all
+
+
+
+
+
+ org.testinfected.hamcrest-matchers
+ jpa-matchers
+ ${hamcrest.jpa-matchers}
+ test
+
+
+
+
+
+ ossrh
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ ${maven-release-plugin.version}
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ ${jdk.source}
+ ${jdk.target}
+ ${jdk.debug}
+ ${jdk.optimize}
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ ${maven-jar-plugin.version}
+
+
+
+ test-jar
+
+
+
+
+
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+ ${cobertura-maven-plugin.version}
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+ ${maven-antrun-plugin.version}
+
+
+ validate
+
+ run
+
+
+
+ *******************************************************************
+ *******************************************************************
+ [project.name] : ${project.name}
+ [project.basedir] : ${project.basedir}
+ [project.version] : ${project.version}
+ [project.artifactId] ${project.artifactId}
+ [project.build.directory] ${project.build.directory}
+ [jdk.source] : ${jdk.source}
+ [jdk.target] : ${jdk.target}
+ [jdk.debug] : ${jdk.debug}
+ [jdk.optimize] : ${jdk.optimize}
+ [source encoding]: ${project.build.sourceEncoding}
+ [LocalRepository] : ${settings.localRepository}
+ *******************************************************************
+ *******************************************************************
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.2
+ true
+
+ ossrh
+ https://oss.sonatype.org/
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.5
+
+ true
+ false
+ release
+ deploy nexus-staging:release
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+ integration
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ ${maven-failsafe-plugin.version}
+
+
+
+ integration-test
+ verify
+
+
+ integration
+ ignoreInCircleCi
+
+ **/*Test.java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+
+
+
+
+ release
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+
+
+
diff --git a/src/main/java/com/github/dockerjava/api/BadRequestException.java b/src/main/java/com/github/dockerjava/api/BadRequestException.java
new file mode 100644
index 00000000..1e04bcb3
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/BadRequestException.java
@@ -0,0 +1,23 @@
+package com.github.dockerjava.api;
+
+
+/**
+ *
+ */
+public class BadRequestException extends DockerException {
+
+ private static final long serialVersionUID = -2450396075981100160L;
+
+ public BadRequestException(String message, Throwable cause) {
+ super(message, 400, cause);
+ }
+
+ public BadRequestException(String message) {
+ this(message, null);
+ }
+
+ public BadRequestException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/ConflictException.java b/src/main/java/com/github/dockerjava/api/ConflictException.java
new file mode 100644
index 00000000..bed2a375
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/ConflictException.java
@@ -0,0 +1,23 @@
+package com.github.dockerjava.api;
+
+
+/**
+ *
+ */
+public class ConflictException extends DockerException {
+
+ private static final long serialVersionUID = -290093024775500239L;
+
+ public ConflictException(String message, Throwable cause) {
+ super(message, 409, cause);
+ }
+
+ public ConflictException(String message) {
+ this(message, null);
+ }
+
+ public ConflictException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/DockerClient.java b/src/main/java/com/github/dockerjava/api/DockerClient.java
new file mode 100644
index 00000000..0e141176
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/DockerClient.java
@@ -0,0 +1,122 @@
+package com.github.dockerjava.api;
+
+import java.io.*;
+
+import com.github.dockerjava.api.command.*;
+import com.github.dockerjava.api.model.AuthConfig;
+import com.github.dockerjava.api.model.Identifier;
+
+// https://godoc.org/github.com/fsouza/go-dockerclient
+public interface DockerClient extends Closeable {
+
+ public AuthConfig authConfig() throws DockerException;
+
+ /**
+ * Authenticate with the server, useful for checking authentication.
+ */
+ public AuthCmd authCmd();
+
+ public InfoCmd infoCmd();
+
+ public PingCmd pingCmd();
+
+ public VersionCmd versionCmd();
+
+ /**
+ * * IMAGE API *
+ */
+
+ public PullImageCmd pullImageCmd(String repository);
+
+ public PushImageCmd pushImageCmd(String name);
+
+ public PushImageCmd pushImageCmd(Identifier identifier);
+
+ public CreateImageCmd createImageCmd(String repository,
+ InputStream imageStream);
+
+ public SearchImagesCmd searchImagesCmd(String term);
+
+ public RemoveImageCmd removeImageCmd(String imageId);
+
+ public ListImagesCmd listImagesCmd();
+
+ public InspectImageCmd inspectImageCmd(String imageId);
+
+ public SaveImageCmd saveImageCmd(String name);
+
+ /**
+ * * CONTAINER API *
+ */
+
+ public ListContainersCmd listContainersCmd();
+
+ public CreateContainerCmd createContainerCmd(String image);
+
+ /**
+ * Creates a new {@link StartContainerCmd} for the container with the
+ * given ID.
+ * The command can then be further customized by using builder
+ * methods on it like {@link StartContainerCmd#withDns(String...)}.
+ *
+ * If you customize the command, any existing configuration of the
+ * target container will get reset to its default before applying the
+ * new configuration. To preserve the existing configuration, use an
+ * unconfigured {@link StartContainerCmd}.
+ *
+ * This command corresponds to the /containers/{id}/start
+ * endpoint of the Docker Remote API.
+ */
+ public StartContainerCmd startContainerCmd(String containerId);
+
+ public ExecCreateCmd execCreateCmd(String containerId);
+
+ public InspectContainerCmd inspectContainerCmd(String containerId);
+
+ public RemoveContainerCmd removeContainerCmd(String containerId);
+
+ public WaitContainerCmd waitContainerCmd(String containerId);
+
+ public AttachContainerCmd attachContainerCmd(String containerId);
+
+ public ExecStartCmd execStartCmd(String containerId);
+
+ public InspectExecCmd inspectExecCmd(String execId);
+
+ public LogContainerCmd logContainerCmd(String containerId);
+
+ public CopyFileFromContainerCmd copyFileFromContainerCmd(
+ String containerId, String resource);
+
+ public ContainerDiffCmd containerDiffCmd(String containerId);
+
+ public StopContainerCmd stopContainerCmd(String containerId);
+
+ public KillContainerCmd killContainerCmd(String containerId);
+
+ public RestartContainerCmd restartContainerCmd(String containerId);
+
+ public StatsCmd statsCmd(String containerId);
+
+ public CommitCmd commitCmd(String containerId);
+
+ public BuildImageCmd buildImageCmd();
+
+ public BuildImageCmd buildImageCmd(File dockerFileOrFolder);
+
+ public BuildImageCmd buildImageCmd(InputStream tarInputStream);
+
+ public TopContainerCmd topContainerCmd(String containerId);
+
+ public TagImageCmd tagImageCmd(String imageId, String repository, String tag);
+
+ public PauseContainerCmd pauseContainerCmd(String containerId);
+
+ public UnpauseContainerCmd unpauseContainerCmd(String containerId);
+
+ public EventsCmd eventsCmd(EventCallback eventCallback);
+
+ public void close() throws IOException;
+
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/DockerClientException.java b/src/main/java/com/github/dockerjava/api/DockerClientException.java
new file mode 100644
index 00000000..85efc349
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/DockerClientException.java
@@ -0,0 +1,18 @@
+package com.github.dockerjava.api;
+
+/**
+ *
+ *
+ */
+public class DockerClientException extends RuntimeException {
+
+private static final long serialVersionUID = 7667768099261650608L;
+
+ public DockerClientException(String message) {
+ super(message);
+ }
+
+ public DockerClientException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/DockerException.java b/src/main/java/com/github/dockerjava/api/DockerException.java
new file mode 100644
index 00000000..673bf2cc
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/DockerException.java
@@ -0,0 +1,30 @@
+package com.github.dockerjava.api;
+
+
+
+
+/**
+ *
+ * @author Konstantin Pelykh (kpelykh@gmail.com)
+ *
+ */
+
+public class DockerException extends RuntimeException {
+
+private static final long serialVersionUID = 7667768099261650608L;
+
+ private int httpStatus = 0;
+
+ public DockerException(String message, int httpStatus) {
+ super(message);
+ this.httpStatus = httpStatus;
+ }
+
+ public DockerException(String message, int httpStatus, Throwable cause) {
+ super(message, cause);
+ }
+
+ public int getHttpStatus() {
+ return httpStatus;
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/InternalServerErrorException.java b/src/main/java/com/github/dockerjava/api/InternalServerErrorException.java
new file mode 100644
index 00000000..366484e5
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/InternalServerErrorException.java
@@ -0,0 +1,22 @@
+package com.github.dockerjava.api;
+
+/**
+ *
+ */
+public class InternalServerErrorException extends DockerException {
+
+ private static final long serialVersionUID = -2450396075981100160L;
+
+ public InternalServerErrorException(String message, Throwable cause) {
+ super(message, 500, cause);
+ }
+
+ public InternalServerErrorException(String message) {
+ this(message, null);
+ }
+
+ public InternalServerErrorException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/NotAcceptableException.java b/src/main/java/com/github/dockerjava/api/NotAcceptableException.java
new file mode 100644
index 00000000..affa4ce9
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/NotAcceptableException.java
@@ -0,0 +1,22 @@
+package com.github.dockerjava.api;
+
+/**
+ *
+ */
+public class NotAcceptableException extends DockerException {
+
+ private static final long serialVersionUID = -1771212181727204375L;
+
+ public NotAcceptableException(String message, Throwable cause) {
+ super(message, 406, cause);
+ }
+
+ public NotAcceptableException(String message) {
+ this(message, null);
+ }
+
+ public NotAcceptableException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/NotFoundException.java b/src/main/java/com/github/dockerjava/api/NotFoundException.java
new file mode 100644
index 00000000..10f328cd
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/NotFoundException.java
@@ -0,0 +1,23 @@
+package com.github.dockerjava.api;
+
+/**
+ * Indicates that the given entity does not exist.
+ *
+ * @author Ryan Campbell ryan.campbell@gmail.com
+ */
+public class NotFoundException extends DockerException {
+
+ private static final long serialVersionUID = -2450396075981100160L;
+
+ public NotFoundException(String message, Throwable cause) {
+ super(message, 404, cause);
+ }
+
+ public NotFoundException(String message) {
+ this(message, null);
+ }
+
+ public NotFoundException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/NotModifiedException.java b/src/main/java/com/github/dockerjava/api/NotModifiedException.java
new file mode 100644
index 00000000..d521bae2
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/NotModifiedException.java
@@ -0,0 +1,22 @@
+package com.github.dockerjava.api;
+
+/**
+ *
+ */
+public class NotModifiedException extends DockerException {
+
+ private static final long serialVersionUID = -290093024775500239L;
+
+ public NotModifiedException(String message, Throwable cause) {
+ super(message, 304, cause);
+ }
+
+ public NotModifiedException(String message) {
+ this(message, null);
+ }
+
+ public NotModifiedException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/UnauthorizedException.java b/src/main/java/com/github/dockerjava/api/UnauthorizedException.java
new file mode 100644
index 00000000..5d48d216
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/UnauthorizedException.java
@@ -0,0 +1,22 @@
+package com.github.dockerjava.api;
+
+/**
+ *
+ */
+public class UnauthorizedException extends DockerException {
+
+ private static final long serialVersionUID = 8257731964780578278L;
+
+ public UnauthorizedException(String message, Throwable cause) {
+ super(message, 401, cause);
+ }
+
+ public UnauthorizedException(String message) {
+ this(message, null);
+ }
+
+ public UnauthorizedException(Throwable cause) {
+ this(cause.getMessage(), cause);
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/AttachContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/AttachContainerCmd.java
new file mode 100644
index 00000000..0fb72d45
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/AttachContainerCmd.java
@@ -0,0 +1,81 @@
+package com.github.dockerjava.api.command;
+
+import java.io.InputStream;
+
+import com.github.dockerjava.api.DockerClient;
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Attach to container
+ *
+ * @param logs
+ * - true or false, includes logs. Defaults to false.
+ *
+ * @param followStream
+ * - true or false, return stream. Defaults to false.
+ * @param stdout
+ * - true or false, includes stdout log. Defaults to false.
+ * @param stderr
+ * - true or false, includes stderr log. Defaults to false.
+ * @param timestamps
+ * - true or false, if true, print timestamps for every log line.
+ * Defaults to false.
+ */
+public interface AttachContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public boolean hasLogsEnabled();
+
+ public boolean hasFollowStreamEnabled();
+
+ public boolean hasTimestampsEnabled();
+
+ public boolean hasStdoutEnabled();
+
+ public boolean hasStderrEnabled();
+
+ public AttachContainerCmd withContainerId(String containerId);
+
+ /**
+ * See {@link #withFollowStream(boolean)}
+ */
+ public AttachContainerCmd withFollowStream();
+
+ /**
+ * Following the stream means the resulting {@link InputStream} returned by
+ * {@link #exec()} reads infinitely. So a {@link InputStream#read()} MAY
+ * BLOCK FOREVER as long as no data is streamed from the docker host to
+ * {@link DockerClient}!
+ */
+ public AttachContainerCmd withFollowStream(boolean followStream);
+
+ public AttachContainerCmd withTimestamps(boolean timestamps);
+
+ public AttachContainerCmd withStdOut();
+
+ public AttachContainerCmd withStdOut(boolean stdout);
+
+ public AttachContainerCmd withStdErr();
+
+ public AttachContainerCmd withStdErr(boolean stderr);
+
+ public AttachContainerCmd withLogs(boolean logs);
+
+ public AttachContainerCmd withLogs();
+
+ /**
+ * Its the responsibility of the caller to consume and/or close the
+ * {@link InputStream} to prevent connection leaks.
+ *
+ * @throws NotFoundException
+ * No such container
+ */
+ @Override
+ public InputStream exec() throws NotFoundException;
+
+ public static interface Exec extends
+ DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/AuthCmd.java b/src/main/java/com/github/dockerjava/api/command/AuthCmd.java
new file mode 100644
index 00000000..3c592258
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/AuthCmd.java
@@ -0,0 +1,29 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.UnauthorizedException;
+import com.github.dockerjava.api.model.AuthConfig;
+import com.github.dockerjava.api.model.AuthResponse;
+
+/**
+ *
+ * Authenticate with the server, useful for checking authentication.
+ *
+ */
+public interface AuthCmd extends DockerCmd {
+
+ public AuthConfig getAuthConfig();
+
+ public AuthCmd withAuthConfig(AuthConfig authConfig);
+
+ /**
+ * @return The status. Based on it's value you may mean you need to authorise your account, e.g.:
+ * "Account created. Please see the documentation of the registry http://localhost:5000/v1/ for instructions how to activate it."
+ * @throws UnauthorizedException If you're not authorised (e.g. bad password).
+ */
+ @Override
+ public AuthResponse exec() throws UnauthorizedException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/BuildImageCmd.java b/src/main/java/com/github/dockerjava/api/command/BuildImageCmd.java
new file mode 100644
index 00000000..925946db
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/BuildImageCmd.java
@@ -0,0 +1,71 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.model.AuthConfigurations;
+import com.github.dockerjava.api.model.EventStreamItem;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ *
+ * Build an image from Dockerfile.
+ *
+ * TODO: http://docs.docker.com/reference/builder/#dockerignore
+ *
+ */
+public interface BuildImageCmd extends DockerCmd{
+
+ public BuildImageCmd withTag(String tag);
+
+ public InputStream getTarInputStream();
+
+ public String getTag();
+
+ public boolean hasNoCacheEnabled();
+
+ public boolean hasRemoveEnabled();
+
+ public boolean isQuiet();
+
+ public boolean hasPullEnabled();
+
+ public String getPathToDockerfile();
+
+ public AuthConfigurations getBuildAuthConfigs();
+
+ public BuildImageCmd withBaseDirectory(File baseDirectory);
+
+ public BuildImageCmd withDockerfile(File dockerfile);
+
+ public BuildImageCmd withTarInputStream(InputStream tarInputStream);
+
+ public BuildImageCmd withNoCache();
+
+ public BuildImageCmd withNoCache(boolean noCache);
+
+ public BuildImageCmd withRemove();
+
+ public BuildImageCmd withRemove(boolean rm);
+
+ public BuildImageCmd withQuiet();
+
+ public BuildImageCmd withQuiet(boolean quiet);
+
+ public BuildImageCmd withPull();
+
+ public BuildImageCmd withPull(boolean pull);
+
+ public BuildImageCmd withBuildAuthConfigs(AuthConfigurations authConfig);
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+ /**
+ * @see {@link com.github.dockerjava.core.command.EventStreamReader}
+ */
+ public static abstract class Response extends InputStream {
+ public abstract Iterable getItems() throws IOException;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/CommitCmd.java b/src/main/java/com/github/dockerjava/api/command/CommitCmd.java
new file mode 100644
index 00000000..ac0a7bb5
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/CommitCmd.java
@@ -0,0 +1,115 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+import com.github.dockerjava.api.model.ExposedPorts;
+import com.github.dockerjava.api.model.Volumes;
+
+/**
+*
+* Create a new image from a container's changes. Returns the new image ID.
+*
+*/
+public interface CommitCmd extends DockerCmd{
+
+ public String getContainerId();
+
+ public CommitCmd withContainerId(String containerId);
+
+ public String getRepository();
+
+ public String getTag();
+
+ public String getMessage();
+
+ public String getAuthor();
+
+ public boolean hasPauseEnabled();
+
+ public CommitCmd withAttachStderr(boolean attachStderr);
+
+ public CommitCmd withAttachStderr();
+
+ public CommitCmd withAttachStdin(boolean attachStdin);
+
+ public CommitCmd withAttachStdin();
+
+ public CommitCmd withAttachStdout(boolean attachStdout);
+
+ public CommitCmd withAttachStdout();
+
+ public CommitCmd withCmd(String... cmd);
+
+ public CommitCmd withDisableNetwork(boolean disableNetwork);
+
+ public CommitCmd withAuthor(String author);
+
+ public CommitCmd withMessage(String message);
+
+ public CommitCmd withTag(String tag);
+
+ public CommitCmd withRepository(String repository);
+
+ public CommitCmd withPause(boolean pause);
+
+ public String[] getEnv();
+
+ public CommitCmd withEnv(String... env);
+
+ public ExposedPorts getExposedPorts();
+
+ public CommitCmd withExposedPorts(ExposedPorts exposedPorts);
+
+ public String getHostname();
+
+ public CommitCmd withHostname(String hostname);
+
+ public Integer getMemory();
+
+ public CommitCmd withMemory(Integer memory);
+
+ public Integer getMemorySwap();
+
+ public CommitCmd withMemorySwap(Integer memorySwap);
+
+ public boolean isOpenStdin();
+
+ public CommitCmd withOpenStdin(boolean openStdin);
+
+ public String[] getPortSpecs();
+
+ public CommitCmd withPortSpecs(String... portSpecs);
+
+ public boolean isStdinOnce();
+
+ public CommitCmd withStdinOnce(boolean stdinOnce);
+
+ public CommitCmd withStdinOnce();
+
+ public boolean isTty();
+
+ public CommitCmd withTty(boolean tty);
+
+ public CommitCmd withTty();
+
+ public String getUser();
+
+ public CommitCmd withUser(String user);
+
+ public Volumes getVolumes();
+
+ public CommitCmd withVolumes(Volumes volumes);
+
+ public String getWorkingDir();
+
+ public CommitCmd withWorkingDir(String workingDir);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public String exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/ContainerDiffCmd.java b/src/main/java/com/github/dockerjava/api/command/ContainerDiffCmd.java
new file mode 100644
index 00000000..21d99045
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/ContainerDiffCmd.java
@@ -0,0 +1,30 @@
+package com.github.dockerjava.api.command;
+
+import java.util.List;
+
+import com.github.dockerjava.api.DockerException;
+import com.github.dockerjava.api.InternalServerErrorException;
+import com.github.dockerjava.api.NotFoundException;
+import com.github.dockerjava.api.model.ChangeLog;
+
+public interface ContainerDiffCmd extends DockerCmd> {
+
+ public String getContainerId();
+
+ public ContainerDiffCmd withContainerId(String containerId);
+
+ @Override
+ public String toString();
+
+ /**
+ * @throws NotFoundException No such container
+ * @throws InternalServerErrorException server error
+ * @throws DockerException unexpected http status code
+ */
+ @Override
+ public List exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec> {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/CopyFileFromContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/CopyFileFromContainerCmd.java
new file mode 100644
index 00000000..5e85d998
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/CopyFileFromContainerCmd.java
@@ -0,0 +1,33 @@
+package com.github.dockerjava.api.command;
+
+import java.io.InputStream;
+
+import com.github.dockerjava.api.NotFoundException;
+
+public interface CopyFileFromContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public String getResource();
+
+ public CopyFileFromContainerCmd withContainerId(String containerId);
+
+ public CopyFileFromContainerCmd withResource(String resource);
+
+ public String getHostPath();
+
+ public CopyFileFromContainerCmd withHostPath(String hostPath);
+
+ /**
+ * Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
+ * connection leaks.
+ *
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public InputStream exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java
new file mode 100644
index 00000000..708e3139
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java
@@ -0,0 +1,245 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.ConflictException;
+import com.github.dockerjava.api.NotFoundException;
+import com.github.dockerjava.api.model.Bind;
+import com.github.dockerjava.api.model.Capability;
+import com.github.dockerjava.api.model.Device;
+import com.github.dockerjava.api.model.ExposedPort;
+import com.github.dockerjava.api.model.HostConfig;
+import com.github.dockerjava.api.model.Link;
+import com.github.dockerjava.api.model.LxcConf;
+import com.github.dockerjava.api.model.PortBinding;
+import com.github.dockerjava.api.model.Ports;
+import com.github.dockerjava.api.model.RestartPolicy;
+import com.github.dockerjava.api.model.Volume;
+import com.github.dockerjava.api.model.VolumesFrom;
+import com.github.dockerjava.core.command.CreateContainerCmdImpl;
+
+public interface CreateContainerCmd extends DockerCmd{
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+ /**
+ * @throws NotFoundException No such container
+ * @throws ConflictException Named container already exists
+ */
+ @Override
+ public CreateContainerResponse exec() throws NotFoundException,
+ ConflictException;
+
+ public Bind[] getBinds();
+
+ public Capability[] getCapAdd();
+
+ public Capability[] getCapDrop();
+
+ public String[] getCmd();
+
+ public String getCpuset();
+
+ public int getCpuShares();
+
+ public Device[] getDevices();
+
+ public String[] getDns();
+
+ public String[] getDnsSearch();
+
+ public String[] getEntrypoint();
+
+ public String[] getEnv();
+
+ public ExposedPort[] getExposedPorts();
+
+ public String[] getExtraHosts();
+
+ public HostConfig getHostConfig();
+
+ public String getHostName();
+
+ public String getImage();
+
+ public Link[] getLinks();
+
+ public LxcConf[] getLxcConf();
+
+ public String getMacAddress();
+
+ public long getMemoryLimit();
+
+ public long getMemorySwap();
+
+ public String getName();
+
+ public String getNetworkMode();
+
+ public Ports getPortBindings();
+
+ public String[] getPortSpecs();
+
+ public RestartPolicy getRestartPolicy();
+
+ public String getUser();
+
+ public Volume[] getVolumes();
+
+ public VolumesFrom[] getVolumesFrom();
+
+ public String getWorkingDir();
+
+ public boolean isAttachStderr();
+
+ public boolean isAttachStdin();
+
+ public boolean isAttachStdout();
+
+ public boolean isNetworkDisabled();
+
+ public Boolean isPrivileged();
+
+ public Boolean isPublishAllPorts();
+
+ public boolean isStdInOnce();
+
+ public boolean isStdinOpen();
+
+ public boolean isTty();
+
+ public CreateContainerCmd withAttachStderr(boolean attachStderr);
+
+ public CreateContainerCmd withAttachStdin(boolean attachStdin);
+
+ public CreateContainerCmd withAttachStdout(boolean attachStdout);
+
+ public CreateContainerCmd withBinds(Bind... binds);
+
+ /**
+ * Add linux kernel
+ * capability to the container. For example: adding {@link Capability#MKNOD}
+ * allows the container to create special files using the 'mknod' command.
+ */
+ public CreateContainerCmd withCapAdd(Capability... capAdd);
+
+ /**
+ * Drop linux kernel
+ * capability from the container. For example: dropping {@link Capability#CHOWN}
+ * prevents the container from changing the owner of any files.
+ */
+ public CreateContainerCmd withCapDrop(Capability... capDrop);
+
+ public CreateContainerCmd withCmd(String... cmd);
+
+ public CreateContainerCmd withCpuset(String cpuset);
+
+ public CreateContainerCmd withCpuShares(int cpuShares);
+
+ /**
+ * Add host devices to the container
+ */
+ public CreateContainerCmd withDevices(Device... devices);
+
+ public CreateContainerCmd withNetworkDisabled(boolean disableNetwork);
+
+ /**
+ * Set custom DNS servers
+ */
+ public CreateContainerCmd withDns(String... dns);
+
+ /**
+ * Set custom DNS search domains
+ */
+ public CreateContainerCmd withDnsSearch(String... dnsSearch);
+
+ public CreateContainerCmd withEntrypoint(String... entrypoint);
+
+ public CreateContainerCmd withEnv(String... env);
+
+ public CreateContainerCmd withExposedPorts(ExposedPort... exposedPorts);
+
+ /**
+ * Add hostnames to /etc/hosts in the container
+ */
+ public CreateContainerCmd withExtraHosts(String... extraHosts);
+
+ public CreateContainerCmd withHostConfig(HostConfig hostConfig);
+
+ public CreateContainerCmd withHostName(String hostName);
+
+ public CreateContainerCmd withImage(String image);
+
+ /**
+ * Add link to another container.
+ */
+ public CreateContainerCmd withLinks(Link... links);
+
+ public CreateContainerCmd withLxcConf(LxcConf... lxcConf);
+
+ public CreateContainerCmd withMemoryLimit(long memoryLimit);
+
+ public CreateContainerCmd withMemorySwap(long memorySwap);
+
+ public CreateContainerCmd withName(String name);
+
+
+ /**
+ * Set the Network mode for the container
+ *
+ *
'bridge': creates a new network stack for the container on the docker
+ * bridge
+ *
'none': no networking for this container
+ *
'container:': reuses another container network stack
+ *
'host': use the host network stack inside the container. Note: the
+ * host mode gives the container full access to local system services such
+ * as D-bus and is therefore considered insecure.
+ *
+ */
+ public CreateContainerCmd withNetworkMode(String networkMode);
+
+ /**
+ * Add one or more {@link PortBinding}s.
+ * This corresponds to the --publish (-p)
+ * option of the docker run CLI command.
+ */
+ public CreateContainerCmd withPortBindings(PortBinding... portBindings);
+
+ /**
+ * Add the port bindings that are contained in the given {@link Ports}
+ * object.
+ *
+ * @see #withPortBindings(PortBinding...)
+ */
+ public CreateContainerCmd withPortBindings(Ports portBindings);
+
+ public CreateContainerCmd withPortSpecs(String... portSpecs);
+
+ public CreateContainerCmd withPrivileged(boolean privileged);
+
+ public CreateContainerCmd withPublishAllPorts(boolean publishAllPorts);
+
+ /**
+ * Set custom {@link RestartPolicy} for the container. Defaults to
+ * {@link RestartPolicy#noRestart()}
+ */
+ public CreateContainerCmd withRestartPolicy(RestartPolicy restartPolicy);
+
+ public CreateContainerCmd withStdInOnce(boolean stdInOnce);
+
+ public CreateContainerCmd withStdinOpen(boolean stdinOpen);
+
+ public CreateContainerCmd withTty(boolean tty);
+
+ public CreateContainerCmd withUser(String user);
+
+ public CreateContainerCmd withVolumes(Volume... volumes);
+
+ public CreateContainerCmd withVolumesFrom(VolumesFrom... volumesFrom);
+
+ public CreateContainerCmd withWorkingDir(String workingDir);
+
+ public CreateContainerCmd withMacAddress(String macAddress);
+
+}
diff --git a/src/main/java/com/kpelykh/docker/client/model/ContainerCreateResponse.java b/src/main/java/com/github/dockerjava/api/command/CreateContainerResponse.java
similarity index 67%
rename from src/main/java/com/kpelykh/docker/client/model/ContainerCreateResponse.java
rename to src/main/java/com/github/dockerjava/api/command/CreateContainerResponse.java
index 8f60ce15..5b0b5a53 100644
--- a/src/main/java/com/kpelykh/docker/client/model/ContainerCreateResponse.java
+++ b/src/main/java/com/github/dockerjava/api/command/CreateContainerResponse.java
@@ -1,45 +1,41 @@
-package com.kpelykh.docker.client.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Arrays;
-
-/**
- *
- * @author Konstantin Pelykh (kpelykh@gmail.com)
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ContainerCreateResponse {
-
- @JsonProperty("Id")
- private String id;
-
- @JsonProperty("Warnings")
- private String[] warnings;
-
- public String getId() {
- return id;
- }
-
- public String[] getWarnings() {
- return warnings;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setWarnings(String[] warnings) {
- this.warnings = warnings;
- }
-
- @Override
- public String toString() {
- return "ContainerCreateResponse{" +
- "id='" + id + '\'' +
- ", warnings=" + Arrays.toString(warnings) +
- '}';
- }
-}
+package com.github.dockerjava.api.command;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * @author Konstantin Pelykh (kpelykh@gmail.com)
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class CreateContainerResponse {
+
+ @JsonProperty("Id")
+ private String id;
+
+ @JsonProperty("Warnings")
+ private String[] warnings;
+
+ public String getId() {
+ return id;
+ }
+
+ public String[] getWarnings() {
+ return warnings;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setWarnings(String[] warnings) {
+ this.warnings = warnings;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/CreateImageCmd.java b/src/main/java/com/github/dockerjava/api/command/CreateImageCmd.java
new file mode 100644
index 00000000..d2682471
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/CreateImageCmd.java
@@ -0,0 +1,34 @@
+package com.github.dockerjava.api.command;
+
+import java.io.InputStream;
+
+public interface CreateImageCmd extends DockerCmd {
+
+ public String getRepository();
+
+ // TODO remove method
+ public String getTag();
+
+ public InputStream getImageStream();
+
+ /**
+ * @param repository the repository to import to
+ */
+ public CreateImageCmd withRepository(String repository);
+
+ /**
+ * @param imageStream the InputStream of the tar file
+ */
+ public CreateImageCmd withImageStream(InputStream imageStream);
+
+ /**
+ * @param tag any tag for this image
+ * @deprecated use repo:tag format for repository
+ */
+ public CreateImageCmd withTag(String tag);
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/kpelykh/docker/client/model/ImageCreateResponse.java b/src/main/java/com/github/dockerjava/api/command/CreateImageResponse.java
similarity index 66%
rename from src/main/java/com/kpelykh/docker/client/model/ImageCreateResponse.java
rename to src/main/java/com/github/dockerjava/api/command/CreateImageResponse.java
index 21545a2d..43731703 100644
--- a/src/main/java/com/kpelykh/docker/client/model/ImageCreateResponse.java
+++ b/src/main/java/com/github/dockerjava/api/command/CreateImageResponse.java
@@ -1,30 +1,27 @@
-package com.kpelykh.docker.client.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Parse reponses from /images/create
- *
- * @author Ryan Campbell (ryan.campbell@gmail.com)
- *
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ImageCreateResponse {
-
- @JsonProperty("status")
- private String id;
-
-
- public String getId() {
- return id;
- }
-
-
- @Override
- public String toString() {
- return "ContainerCreateResponse{" +
- "id='" + id + '\'' +
- '}';
- }
-}
+package com.github.dockerjava.api.command;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * Parse reponses from /images/create
+ *
+ * @author Ryan Campbell (ryan.campbell@gmail.com)
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class CreateImageResponse {
+
+ @JsonProperty("status")
+ private String id;
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/DockerCmd.java b/src/main/java/com/github/dockerjava/api/command/DockerCmd.java
new file mode 100644
index 00000000..89c31666
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/DockerCmd.java
@@ -0,0 +1,9 @@
+package com.github.dockerjava.api.command;
+
+import java.io.Closeable;
+
+public interface DockerCmd extends Closeable {
+
+ public RES_T exec();
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/DockerCmdExec.java b/src/main/java/com/github/dockerjava/api/command/DockerCmdExec.java
new file mode 100644
index 00000000..8cf13e7b
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/DockerCmdExec.java
@@ -0,0 +1,7 @@
+package com.github.dockerjava.api.command;
+
+public interface DockerCmdExec, RES_T> {
+
+ public RES_T exec(CMD_T command);
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/DockerCmdExecFactory.java b/src/main/java/com/github/dockerjava/api/command/DockerCmdExecFactory.java
new file mode 100644
index 00000000..8d54a394
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/DockerCmdExecFactory.java
@@ -0,0 +1,87 @@
+package com.github.dockerjava.api.command;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+import com.github.dockerjava.core.DockerClientConfig;
+
+public interface DockerCmdExecFactory extends Closeable {
+
+ public void init(DockerClientConfig dockerClientConfig);
+
+ public AuthCmd.Exec createAuthCmdExec();
+
+ public InfoCmd.Exec createInfoCmdExec();
+
+ public PingCmd.Exec createPingCmdExec();
+
+ public ExecCreateCmd.Exec createExecCmdExec();
+
+ public VersionCmd.Exec createVersionCmdExec();
+
+ public PullImageCmd.Exec createPullImageCmdExec();
+
+ public PushImageCmd.Exec createPushImageCmdExec();
+
+ public SaveImageCmd.Exec createSaveImageCmdExec();
+
+ public CreateImageCmd.Exec createCreateImageCmdExec();
+
+ public SearchImagesCmd.Exec createSearchImagesCmdExec();
+
+ public RemoveImageCmd.Exec createRemoveImageCmdExec();
+
+ public ListImagesCmd.Exec createListImagesCmdExec();
+
+ public InspectImageCmd.Exec createInspectImageCmdExec();
+
+ public ListContainersCmd.Exec createListContainersCmdExec();
+
+ public CreateContainerCmd.Exec createCreateContainerCmdExec();
+
+ public StartContainerCmd.Exec createStartContainerCmdExec();
+
+ public InspectContainerCmd.Exec createInspectContainerCmdExec();
+
+ public RemoveContainerCmd.Exec createRemoveContainerCmdExec();
+
+ public WaitContainerCmd.Exec createWaitContainerCmdExec();
+
+ public AttachContainerCmd.Exec createAttachContainerCmdExec();
+
+ public ExecStartCmd.Exec createExecStartCmdExec();
+
+ public InspectExecCmd.Exec createInspectExecCmdExec();
+
+ public LogContainerCmd.Exec createLogContainerCmdExec();
+
+ public CopyFileFromContainerCmd.Exec createCopyFileFromContainerCmdExec();
+
+ public StopContainerCmd.Exec createStopContainerCmdExec();
+
+ public ContainerDiffCmd.Exec createContainerDiffCmdExec();
+
+ public KillContainerCmd.Exec createKillContainerCmdExec();
+
+ public RestartContainerCmd.Exec createRestartContainerCmdExec();
+
+ public CommitCmd.Exec createCommitCmdExec();
+
+ public BuildImageCmd.Exec createBuildImageCmdExec();
+
+ public TopContainerCmd.Exec createTopContainerCmdExec();
+
+ public TagImageCmd.Exec createTagImageCmdExec();
+
+ public PauseContainerCmd.Exec createPauseContainerCmdExec();
+
+ public UnpauseContainerCmd.Exec createUnpauseContainerCmdExec();
+
+ public EventsCmd.Exec createEventsCmdExec();
+
+ public void close() throws IOException;
+
+ // add
+ public StatsCmd.Exec createStatsCmdExec();
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/EventCallback.java b/src/main/java/com/github/dockerjava/api/command/EventCallback.java
new file mode 100644
index 00000000..18b8669e
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/EventCallback.java
@@ -0,0 +1,13 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.model.Event;
+
+/**
+ * Event callback
+ */
+public interface EventCallback {
+ public void onEvent(Event event);
+ public void onException(Throwable throwable);
+ public void onCompletion(int numEvents);
+ public boolean isReceiving();
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/EventsCmd.java b/src/main/java/com/github/dockerjava/api/command/EventsCmd.java
new file mode 100644
index 00000000..cfdb23a6
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/EventsCmd.java
@@ -0,0 +1,27 @@
+package com.github.dockerjava.api.command;
+
+import java.util.concurrent.ExecutorService;
+
+
+/**
+ * Get events
+ *
+ * @param since - Show all events created since timestamp
+ * @param until - Stream events until this timestamp
+ */
+public interface EventsCmd extends DockerCmd {
+ public EventsCmd withSince(String since);
+
+ public EventsCmd withUntil(String until);
+
+ public String getSince();
+
+ public String getUntil();
+
+ public EventCallback getEventCallback();
+
+ public EventsCmd withEventCallback(EventCallback eventCallback);
+
+ public static interface Exec extends DockerCmdExec {
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/ExecCreateCmd.java b/src/main/java/com/github/dockerjava/api/command/ExecCreateCmd.java
new file mode 100644
index 00000000..c1f32e29
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/ExecCreateCmd.java
@@ -0,0 +1,37 @@
+package com.github.dockerjava.api.command;
+
+public interface ExecCreateCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public ExecCreateCmd withContainerId(String containerId);
+
+ public ExecCreateCmd withCmd(String... cmd);
+
+ public ExecCreateCmd withAttachStdin(boolean attachStdin);
+
+ public ExecCreateCmd withAttachStdin();
+
+ public boolean hasAttachStdinEnabled();
+
+ public ExecCreateCmd withAttachStdout(boolean attachStdout);
+
+ public ExecCreateCmd withAttachStdout();
+
+ public boolean hasAttachStdoutEnabled();
+
+ public ExecCreateCmd withAttachStderr(boolean attachStderr);
+
+ public ExecCreateCmd withAttachStderr();
+
+ public boolean hasAttachStderrEnabled();
+
+ public ExecCreateCmd withTty(boolean tty);
+
+ public ExecCreateCmd withTty();
+
+ public boolean hasTtyEnabled();
+
+ public static interface Exec extends DockerCmdExec {
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/ExecCreateCmdResponse.java b/src/main/java/com/github/dockerjava/api/command/ExecCreateCmdResponse.java
new file mode 100644
index 00000000..391625cf
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/ExecCreateCmdResponse.java
@@ -0,0 +1,15 @@
+package com.github.dockerjava.api.command;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ExecCreateCmdResponse {
+
+ @JsonProperty("Id")
+ private String id;
+
+ public String getId() {
+ return id;
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/ExecStartCmd.java b/src/main/java/com/github/dockerjava/api/command/ExecStartCmd.java
new file mode 100644
index 00000000..7ccb90cf
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/ExecStartCmd.java
@@ -0,0 +1,38 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+import java.io.InputStream;
+
+public interface ExecStartCmd extends DockerCmd {
+
+ public String getExecId();
+
+ public ExecStartCmd withExecId(String execId);
+
+ public boolean hasDetachEnabled();
+
+ public ExecStartCmd withDetach(boolean detach);
+
+ public ExecStartCmd withDetach();
+
+ public boolean hasTtyEnabled();
+
+ public ExecStartCmd withTty(boolean tty);
+
+ public ExecStartCmd withTty();
+
+ /**
+ * Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
+ * connection leaks.
+ *
+ * @throws com.github.dockerjava.api.NotFoundException
+ * No such exec instance
+ */
+ @Override
+ public InputStream exec() throws NotFoundException;
+
+ public static interface Exec extends
+ DockerCmdExec {
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/InfoCmd.java b/src/main/java/com/github/dockerjava/api/command/InfoCmd.java
new file mode 100644
index 00000000..d340fe26
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InfoCmd.java
@@ -0,0 +1,10 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.model.Info;
+
+public interface InfoCmd extends DockerCmd {
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/InspectContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/InspectContainerCmd.java
new file mode 100644
index 00000000..f67fe4ae
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InspectContainerCmd.java
@@ -0,0 +1,20 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+public interface InspectContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public InspectContainerCmd withContainerId(String containerId);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public InspectContainerResponse exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/InspectContainerResponse.java b/src/main/java/com/github/dockerjava/api/command/InspectContainerResponse.java
new file mode 100644
index 00000000..f9565689
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InspectContainerResponse.java
@@ -0,0 +1,251 @@
+package com.github.dockerjava.api.command;
+
+
+import java.util.List;
+import java.util.Map;
+
+import com.github.dockerjava.api.model.*;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ *
+ * @author Konstantin Pelykh (kpelykh@gmail.com)
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class InspectContainerResponse {
+
+ @JsonProperty("Args")
+ private String[] args;
+
+ @JsonProperty("Config")
+ private ContainerConfig config;
+
+ @JsonProperty("Created")
+ private String created;
+
+ @JsonProperty("Driver")
+ private String driver;
+
+ @JsonProperty("ExecDriver")
+ private String execDriver;
+
+ @JsonProperty("HostConfig")
+ private HostConfig hostConfig;
+
+ @JsonProperty("HostnamePath")
+ private String hostnamePath;
+
+ @JsonProperty("HostsPath")
+ private String hostsPath;
+
+ @JsonProperty("Id")
+ private String id;
+
+ @JsonProperty("Image")
+ private String imageId;
+
+ @JsonProperty("MountLabel")
+ private String mountLabel;
+
+ @JsonProperty("Name")
+ private String name;
+
+ @JsonProperty("NetworkSettings")
+ private NetworkSettings networkSettings;
+
+ @JsonProperty("Path")
+ private String path;
+
+ @JsonProperty("ProcessLabel")
+ private String processLabel;
+
+ @JsonProperty("ResolvConfPath")
+ private String resolvConfPath;
+
+ @JsonProperty("ExecIDs")
+ private List execIds;
+
+ @JsonProperty("State")
+ private ContainerState state;
+
+ @JsonProperty("Volumes")
+ private VolumeBinds volumes;
+
+ @JsonProperty("VolumesRW")
+ private VolumesRW volumesRW;
+
+ public String getId() {
+ return id;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getProcessLabel() {
+ return processLabel;
+ }
+
+ public String[] getArgs() {
+ return args;
+ }
+
+ public ContainerConfig getConfig() {
+ return config;
+ }
+
+ public ContainerState getState() {
+ return state;
+ }
+
+ public String getImageId() {
+ return imageId;
+ }
+
+ public NetworkSettings getNetworkSettings() {
+ return networkSettings;
+ }
+
+ public String getResolvConfPath() {
+ return resolvConfPath;
+ }
+
+ @JsonIgnore
+ public VolumeBind[] getVolumes() {
+ return volumes.getBinds();
+ }
+
+ @JsonIgnore
+ public VolumeRW[] getVolumesRW() {
+ return volumesRW.getVolumesRW();
+ }
+
+ public String getHostnamePath() {
+ return hostnamePath;
+ }
+
+ public String getHostsPath() {
+ return hostsPath;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDriver() {
+ return driver;
+ }
+
+ public HostConfig getHostConfig() {
+ return hostConfig;
+ }
+
+ public String getExecDriver() {
+ return execDriver;
+ }
+
+ public String getMountLabel() {
+ return mountLabel;
+ }
+
+ public List getExecIds() {
+ return execIds;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public class NetworkSettings {
+
+ @JsonProperty("IPAddress") private String ipAddress;
+ @JsonProperty("IPPrefixLen") private int ipPrefixLen;
+ @JsonProperty("Gateway") private String gateway;
+ @JsonProperty("Bridge") private String bridge;
+ @JsonProperty("PortMapping") private Map> portMapping;
+ @JsonProperty("Ports") private Ports ports;
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public int getIpPrefixLen() {
+ return ipPrefixLen;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public String getBridge() {
+ return bridge;
+ }
+
+ public Map> getPortMapping() {
+ return portMapping;
+ }
+
+ public Ports getPorts() {
+ return ports;
+ }
+
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public class ContainerState {
+
+ @JsonProperty("Running") private boolean running;
+ @JsonProperty("Paused") private boolean paused;
+ @JsonProperty("Pid") private int pid;
+ @JsonProperty("ExitCode") private int exitCode;
+ @JsonProperty("StartedAt") private String startedAt;
+ @JsonProperty("FinishedAt") private String finishedAt;
+
+ public boolean isRunning() {
+ return running;
+ }
+
+ public boolean isPaused() {
+ return paused;
+ }
+
+ public int getPid() {
+ return pid;
+ }
+
+ public int getExitCode() {
+ return exitCode;
+ }
+
+ public String getStartedAt() {
+ return startedAt;
+ }
+
+ public String getFinishedAt() {
+ return finishedAt;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+ }
+
+}
+
diff --git a/src/main/java/com/github/dockerjava/api/command/InspectExecCmd.java b/src/main/java/com/github/dockerjava/api/command/InspectExecCmd.java
new file mode 100644
index 00000000..13882b8f
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InspectExecCmd.java
@@ -0,0 +1,16 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+public interface InspectExecCmd extends DockerCmd {
+ public String getExecId();
+ public InspectExecCmd withExecId(String execId);
+
+ /**
+ * @throws NotFoundException if no such exec has been found
+ */
+ @Override
+ public InspectExecResponse exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {}
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/InspectExecResponse.java b/src/main/java/com/github/dockerjava/api/command/InspectExecResponse.java
new file mode 100644
index 00000000..1532f7d5
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InspectExecResponse.java
@@ -0,0 +1,100 @@
+package com.github.dockerjava.api.command;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class InspectExecResponse {
+ @JsonProperty("ID")
+ private String id;
+
+ @JsonProperty("OpenStdin")
+ private boolean openStdin;
+
+ @JsonProperty("OpenStderr")
+ private boolean openStderr;
+
+ @JsonProperty("OpenStdout")
+ private boolean openStdout;
+
+ @JsonProperty("Running")
+ private boolean running;
+
+ @JsonProperty("ExitCode")
+ private int exitCode;
+
+ public String getId() {
+ return id;
+ }
+
+ public boolean isOpenStdin() {
+ return openStdin;
+ }
+
+ public boolean isOpenStderr() {
+ return openStderr;
+ }
+
+ public boolean isOpenStdout() {
+ return openStdout;
+ }
+
+ public boolean isRunning() {
+ return running;
+ }
+
+ public int getExitCode() {
+ return exitCode;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public class ProcessConfig {
+ @JsonProperty("arguments")
+ private List arguments;
+
+ @JsonProperty("entrypoint")
+ private String entryPoint;
+
+ @JsonProperty("privileged")
+ private boolean privileged;
+
+ @JsonProperty("tty")
+ private boolean tty;
+
+ @JsonProperty("user")
+ private String user;
+
+ public List getArguments() {
+ return arguments;
+ }
+
+ public String getEntryPoint() {
+ return entryPoint;
+ }
+
+ public boolean isPrivileged() {
+ return privileged;
+ }
+
+ public boolean isTty() {
+ return tty;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/InspectImageCmd.java b/src/main/java/com/github/dockerjava/api/command/InspectImageCmd.java
new file mode 100644
index 00000000..d064badb
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InspectImageCmd.java
@@ -0,0 +1,23 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Inspect the details of an image.
+ */
+public interface InspectImageCmd extends DockerCmd{
+
+ public String getImageId();
+
+ public InspectImageCmd withImageId(String imageId);
+
+ /**
+ * @throws NotFoundException No such image
+ */
+ @Override
+ public InspectImageResponse exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/InspectImageResponse.java b/src/main/java/com/github/dockerjava/api/command/InspectImageResponse.java
new file mode 100644
index 00000000..b5b6432d
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/InspectImageResponse.java
@@ -0,0 +1,105 @@
+package com.github.dockerjava.api.command;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.github.dockerjava.api.model.ContainerConfig;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ *
+ * @author Konstantin Pelykh (kpelykh@gmail.com)
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class InspectImageResponse {
+
+ @JsonProperty("Architecture")
+ private String arch;
+
+ @JsonProperty("Author")
+ private String author;
+
+ @JsonProperty("Comment")
+ private String comment;
+
+ @JsonProperty("Config")
+ private ContainerConfig config;
+
+ @JsonProperty("Container")
+ private String container;
+
+ @JsonProperty("ContainerConfig")
+ private ContainerConfig containerConfig;
+
+ @JsonProperty("Created")
+ private String created;
+
+ @JsonProperty("DockerVersion")
+ private String dockerVersion;
+
+ @JsonProperty("Id")
+ private String id;
+
+ @JsonProperty("Os")
+ private String os;
+
+ @JsonProperty("Parent")
+ private String parent;
+
+ @JsonProperty("Size")
+ private long size;
+
+ public String getId() {
+ return id;
+ }
+
+ public String getParent() {
+ return parent;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public String getContainer() {
+ return container;
+ }
+
+ public ContainerConfig getContainerConfig() {
+ return containerConfig;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public String getDockerVersion() {
+ return dockerVersion;
+ }
+
+ public ContainerConfig getConfig() {
+ return config;
+ }
+
+ public String getArch() {
+ return arch;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+ public String getOs() {
+ return os;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/KillContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/KillContainerCmd.java
new file mode 100644
index 00000000..b9522cb8
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/KillContainerCmd.java
@@ -0,0 +1,27 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Kill a running container.
+ */
+public interface KillContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public String getSignal();
+
+ public KillContainerCmd withContainerId(String containerId);
+
+ public KillContainerCmd withSignal(String signal);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public Void exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/ListContainersCmd.java b/src/main/java/com/github/dockerjava/api/command/ListContainersCmd.java
new file mode 100644
index 00000000..ed457dab
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/ListContainersCmd.java
@@ -0,0 +1,42 @@
+package com.github.dockerjava.api.command;
+
+import java.util.List;
+
+import com.github.dockerjava.api.model.Container;
+
+/**
+ * List containers
+ *
+ * @param showAll - true or false, Show all containers. Only running containers are shown by default.
+ * @param showSize - true or false, Show the containers sizes. This is false by default.
+ * @param limit - Show `limit` last created containers, include non-running ones. There is no limit by default.
+ * @param sinceId - Show only containers created since Id, include non-running ones.
+ * @param beforeId - Show only containers created before Id, include non-running ones.
+ *
+ */
+public interface ListContainersCmd extends DockerCmd>{
+
+ public int getLimit();
+
+ public boolean hasShowSizeEnabled();
+
+ public boolean hasShowAllEnabled();
+
+ public String getSinceId();
+
+ public String getBeforeId();
+
+ public ListContainersCmd withShowAll(boolean showAll);
+
+ public ListContainersCmd withShowSize(boolean showSize);
+
+ public ListContainersCmd withLimit(int limit);
+
+ public ListContainersCmd withSince(String since);
+
+ public ListContainersCmd withBefore(String before);
+
+ public static interface Exec extends DockerCmdExec> {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/ListImagesCmd.java b/src/main/java/com/github/dockerjava/api/command/ListImagesCmd.java
new file mode 100644
index 00000000..fad6d1da
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/ListImagesCmd.java
@@ -0,0 +1,26 @@
+package com.github.dockerjava.api.command;
+
+import java.util.List;
+
+import com.github.dockerjava.api.model.Image;
+
+/**
+ * List images
+ *
+ * @param showAll - Show all images (by default filter out the intermediate images used to build)
+ * @param filters - a json encoded value of the filters (a map[string][]string) to process on the images list.
+ */
+public interface ListImagesCmd extends DockerCmd> {
+
+ public String getFilters();
+
+ public boolean hasShowAllEnabled();
+
+ public ListImagesCmd withShowAll(boolean showAll);
+
+ public ListImagesCmd withFilters(String filters);
+
+ public static interface Exec extends DockerCmdExec> {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/LogContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/LogContainerCmd.java
new file mode 100644
index 00000000..c966ef95
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/LogContainerCmd.java
@@ -0,0 +1,88 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.DockerClient;
+import com.github.dockerjava.api.NotFoundException;
+
+import java.io.InputStream;
+
+/**
+ * Get container logs
+ *
+ * @param followStream
+ * - true or false, return stream. Defaults to false.
+ * @param stdout
+ * - true or false, includes stdout log. Defaults to false.
+ * @param stderr
+ * - true or false, includes stderr log. Defaults to false.
+ * @param timestamps
+ * - true or false, if true, print timestamps for every log line.
+ * Defaults to false.
+ * @param tail
+ * - `all` or ``, Output specified number of lines at the end
+ * of logs
+ *
+ * Consider wrapping any input stream you get with a frame reader to
+ * make reading frame easier.
+ *
+ * @see com.github.dockerjava.core.command.FrameReader
+ */
+public interface LogContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public int getTail();
+
+ public boolean hasFollowStreamEnabled();
+
+ public boolean hasTimestampsEnabled();
+
+ public boolean hasStdoutEnabled();
+
+ public boolean hasStderrEnabled();
+
+ public LogContainerCmd withContainerId(String containerId);
+
+ /**
+ * See {@link #withFollowStream(boolean)}
+ */
+ public LogContainerCmd withFollowStream();
+
+ /**
+ * Following the stream means the resulting {@link InputStream} returned by
+ * {@link #exec()} reads infinitely. So a {@link InputStream#read()} MAY
+ * BLOCK FOREVER as long as no data is streamed from the docker host to
+ * {@link DockerClient}!
+ */
+ public LogContainerCmd withFollowStream(boolean followStream);
+
+ public LogContainerCmd withTimestamps();
+
+ public LogContainerCmd withTimestamps(boolean timestamps);
+
+ public LogContainerCmd withStdOut();
+
+ public LogContainerCmd withStdOut(boolean stdout);
+
+ public LogContainerCmd withStdErr();
+
+ public LogContainerCmd withStdErr(boolean stderr);
+
+ public LogContainerCmd withTailAll();
+
+ public LogContainerCmd withTail(int tail);
+
+ /**
+ * Its the responsibility of the caller to consume and/or close the
+ * {@link InputStream} to prevent connection leaks.
+ *
+ * @throws NotFoundException
+ * No such container
+ */
+ @Override
+ public InputStream exec() throws NotFoundException;
+
+ public static interface Exec extends
+ DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/PauseContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/PauseContainerCmd.java
new file mode 100644
index 00000000..652d433e
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/PauseContainerCmd.java
@@ -0,0 +1,26 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Pause a container.
+ *
+ * @param containerId - Id of the container
+ *
+ */
+public interface PauseContainerCmd extends DockerCmd{
+
+ public String getContainerId();
+
+ public PauseContainerCmd withContainerId(String containerId);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public Void exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/PingCmd.java b/src/main/java/com/github/dockerjava/api/command/PingCmd.java
new file mode 100644
index 00000000..7d5af1e3
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/PingCmd.java
@@ -0,0 +1,13 @@
+package com.github.dockerjava.api.command;
+
+
+/**
+ * Ping the Docker server
+ *
+ */
+public interface PingCmd extends DockerCmd {
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/PullImageCmd.java b/src/main/java/com/github/dockerjava/api/command/PullImageCmd.java
new file mode 100644
index 00000000..4b5fc4c3
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/PullImageCmd.java
@@ -0,0 +1,43 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.model.AuthConfig;
+import com.github.dockerjava.core.command.EventStreamReader;
+
+import java.io.InputStream;
+
+/**
+*
+* Pull image from repository.
+*
+*/
+public interface PullImageCmd extends DockerCmd{
+
+ public String getRepository();
+
+ public String getTag();
+
+ public String getRegistry();
+
+ public AuthConfig getAuthConfig();
+
+ public PullImageCmd withRepository(String repository);
+
+ public PullImageCmd withTag(String tag);
+
+ public PullImageCmd withRegistry(String registry);
+
+ public PullImageCmd withAuthConfig(AuthConfig authConfig);
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+ /**
+ * Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
+ * connection leaks.
+ *
+ * @see {@link EventStreamReader}
+ */
+ @Override
+ public InputStream exec();
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/PushImageCmd.java b/src/main/java/com/github/dockerjava/api/command/PushImageCmd.java
new file mode 100644
index 00000000..9ed38beb
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/PushImageCmd.java
@@ -0,0 +1,51 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+import com.github.dockerjava.api.model.AuthConfig;
+import com.github.dockerjava.api.model.PushEventStreamItem;
+import com.github.dockerjava.core.command.EventStreamReader;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Push the latest image to the repository.
+ *
+ * @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
+ */
+public interface PushImageCmd extends DockerCmd{
+
+ public String getName();
+
+ public String getTag();
+
+ /**
+ * @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
+ */
+ public PushImageCmd withName(String name);
+
+ /**
+ * @param tag The image's tag. Not null.
+ */
+ public PushImageCmd withTag(String tag);
+
+ public AuthConfig getAuthConfig();
+
+ public PushImageCmd withAuthConfig(AuthConfig authConfig);
+
+ /**
+ * @throws NotFoundException No such image
+ */
+ public Response exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+ /**
+ * @see {@link EventStreamReader}
+ */
+ public static abstract class Response extends InputStream {
+ public abstract Iterable getItems() throws IOException;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/RemoveContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/RemoveContainerCmd.java
new file mode 100644
index 00000000..b9c1f943
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/RemoveContainerCmd.java
@@ -0,0 +1,36 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Remove a container.
+ *
+ * @param removeVolumes - true or false, Remove the volumes associated to the container. Defaults to false
+ * @param force - true or false, Removes the container even if it was running. Defaults to false
+ */
+public interface RemoveContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public boolean hasRemoveVolumesEnabled();
+
+ public boolean hasForceEnabled();
+
+ public RemoveContainerCmd withContainerId(String containerId);
+
+ public RemoveContainerCmd withRemoveVolumes(boolean removeVolumes);
+
+ public RemoveContainerCmd withForce();
+
+ public RemoveContainerCmd withForce(boolean force);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public Void exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/RemoveImageCmd.java b/src/main/java/com/github/dockerjava/api/command/RemoveImageCmd.java
new file mode 100644
index 00000000..be65ca41
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/RemoveImageCmd.java
@@ -0,0 +1,50 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+*
+* Remove an image, deleting any tags it might have.
+*
+*/
+public interface RemoveImageCmd extends DockerCmd{
+
+ public String getImageId();
+
+ public boolean hasForceEnabled();
+
+ public boolean hasNoPruneEnabled();
+
+ public RemoveImageCmd withImageId(String imageId);
+
+ /**
+ * force delete of an image, even if it's tagged in multiple repositories
+ */
+ public RemoveImageCmd withForce();
+
+ /**
+ * force parameter to force delete of an image, even if it's tagged in multiple repositories
+ */
+ public RemoveImageCmd withForce(boolean force);
+
+ /**
+ * prevent the deletion of parent images
+ */
+ public RemoveImageCmd withNoPrune();
+
+ /**
+ * noprune parameter to prevent the deletion of parent images
+ *
+ */
+ public RemoveImageCmd withNoPrune(boolean noPrune);
+
+ /**
+ * @throws NotFoundException No such image
+ */
+ @Override
+ public Void exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/RestartContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/RestartContainerCmd.java
new file mode 100644
index 00000000..8da41d38
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/RestartContainerCmd.java
@@ -0,0 +1,30 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Restart a running container.
+ *
+ * @param timeout - Timeout in seconds before killing the container. Defaults to 10 seconds.
+ *
+ */
+public interface RestartContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public int getTimeout();
+
+ public RestartContainerCmd withContainerId(String containerId);
+
+ public RestartContainerCmd withtTimeout(int timeout);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public Void exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/SaveImageCmd.java b/src/main/java/com/github/dockerjava/api/command/SaveImageCmd.java
new file mode 100644
index 00000000..48c5f319
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/SaveImageCmd.java
@@ -0,0 +1,35 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+import java.io.InputStream;
+
+public interface SaveImageCmd extends DockerCmd{
+
+ public String getName();
+
+ public String getTag();
+
+ /**
+ * @param name The name, e.g. "alexec/busybox" or just "busybox" if you want to default. Not null.
+ */
+ public SaveImageCmd withName(String name);
+
+ /**
+ * @param tag The image's tag. Not null.
+ */
+ public SaveImageCmd withTag(String tag);
+
+ /**
+ * Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
+ * connection leaks.
+ *
+ * @throws com.github.dockerjava.api.NotFoundException No such image
+ */
+ public InputStream exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/SearchImagesCmd.java b/src/main/java/com/github/dockerjava/api/command/SearchImagesCmd.java
new file mode 100644
index 00000000..c609e6e8
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/SearchImagesCmd.java
@@ -0,0 +1,22 @@
+package com.github.dockerjava.api.command;
+
+import java.util.List;
+
+import com.github.dockerjava.api.model.SearchItem;
+
+/**
+ * Search images
+ *
+ * @param term - search term
+ *
+ */
+public interface SearchImagesCmd extends DockerCmd> {
+
+ public String getTerm();
+
+ public SearchImagesCmd withTerm(String term);
+
+ public static interface Exec extends DockerCmdExec> {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java
new file mode 100644
index 00000000..e76598e3
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/StartContainerCmd.java
@@ -0,0 +1,170 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+import com.github.dockerjava.api.NotModifiedException;
+import com.github.dockerjava.api.model.Bind;
+import com.github.dockerjava.api.model.Capability;
+import com.github.dockerjava.api.model.Device;
+import com.github.dockerjava.api.model.Link;
+import com.github.dockerjava.api.model.LxcConf;
+import com.github.dockerjava.api.model.PortBinding;
+import com.github.dockerjava.api.model.Ports;
+import com.github.dockerjava.api.model.RestartPolicy;
+
+/**
+ * Start a container.
+ *
+ * TODO: Almost all methods are deprecated as they have corresponding siblings in {@link CreateContainerCmd} now.
+ */
+public interface StartContainerCmd extends DockerCmd {
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+ /**
+ * @throws NotFoundException
+ * No such container
+ * @throws NotModifiedException
+ * Container already started
+ */
+ @Override
+ public Void exec() throws NotFoundException, NotModifiedException;
+
+ public Bind[] getBinds();
+
+ public Capability[] getCapAdd();
+
+ public Capability[] getCapDrop();
+
+ public String getContainerId();
+
+ public Device[] getDevices();
+
+ public String[] getDns();
+
+ public String[] getDnsSearch();
+
+ public String[] getExtraHosts();
+
+ public Link[] getLinks();
+
+ public LxcConf[] getLxcConf();
+
+ public String getNetworkMode();
+
+ public Ports getPortBindings();
+
+ public RestartPolicy getRestartPolicy();
+
+ public String getVolumesFrom();
+
+ public Boolean isPrivileged();
+
+ public Boolean isPublishAllPorts();
+
+ @Deprecated
+ public StartContainerCmd withBinds(Bind... binds);
+
+ /**
+ * Add linux kernel
+ * capability to the container. For example: adding {@link Capability#MKNOD}
+ * allows the container to create special files using the 'mknod' command.
+ */
+ @Deprecated
+ public StartContainerCmd withCapAdd(Capability... capAdd);
+
+ /**
+ * Drop linux kernel
+ * capability from the container. For example: dropping {@link Capability#CHOWN}
+ * prevents the container from changing the owner of any files.
+ */
+ @Deprecated
+ public StartContainerCmd withCapDrop(Capability... capDrop);
+
+ @Deprecated
+ public StartContainerCmd withContainerId(String containerId);
+
+ /**
+ * Add host devices to the container
+ */
+ @Deprecated
+ public StartContainerCmd withDevices(Device... devices);
+
+ /**
+ * Set custom DNS servers
+ */
+ @Deprecated
+ public StartContainerCmd withDns(String... dns);
+
+ /**
+ * Set custom DNS search domains
+ */
+ @Deprecated
+ public StartContainerCmd withDnsSearch(String... dnsSearch);
+
+ /**
+ * Add hostnames to /etc/hosts in the container
+ */
+ @Deprecated
+ public StartContainerCmd withExtraHosts(String... extraHosts);
+
+ /**
+ * Add link to another container.
+ */
+ @Deprecated
+ public StartContainerCmd withLinks(Link... links);
+
+ @Deprecated
+ public StartContainerCmd withLxcConf(LxcConf... lxcConf);
+
+ /**
+ * Set the Network mode for the container
+ *
+ *
'bridge': creates a new network stack for the container on the docker
+ * bridge
+ *
'none': no networking for this container
+ *
'container:': reuses another container network stack
+ *
'host': use the host network stack inside the container. Note: the
+ * host mode gives the container full access to local system services such
+ * as D-bus and is therefore considered insecure.
+ *
+ */
+ @Deprecated
+ public StartContainerCmd withNetworkMode(String networkMode);
+
+ /**
+ * Add one or more {@link PortBinding}s.
+ * This corresponds to the --publish (-p)
+ * option of the docker run CLI command.
+ */
+ @Deprecated
+ public StartContainerCmd withPortBindings(PortBinding... portBindings);
+
+ /**
+ * Add the port bindings that are contained in the given {@link Ports}
+ * object.
+ *
+ * @see #withPortBindings(PortBinding...)
+ */
+ @Deprecated
+ public StartContainerCmd withPortBindings(Ports portBindings);
+
+ @Deprecated
+ public StartContainerCmd withPrivileged(Boolean privileged);
+
+ @Deprecated
+ public StartContainerCmd withPublishAllPorts(Boolean publishAllPorts);
+
+ /**
+ * Set custom {@link RestartPolicy} for the container. Defaults to
+ * {@link RestartPolicy#noRestart()}
+ */
+ @Deprecated
+ public StartContainerCmd withRestartPolicy(RestartPolicy restartPolicy);
+
+ @Deprecated
+ public StartContainerCmd withVolumesFrom(String volumesFrom);
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/StatsCmd.java b/src/main/java/com/github/dockerjava/api/command/StatsCmd.java
new file mode 100644
index 00000000..dc57196e
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/StatsCmd.java
@@ -0,0 +1,15 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.model.Stats;
+
+/**
+ * @author Heng WU(wuheng09@otcaix.iscas.ac.cn)
+ *
+ */
+public interface StatsCmd extends DockerCmd {
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+ public String getContainerId();
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/StopContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/StopContainerCmd.java
new file mode 100644
index 00000000..19c24855
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/StopContainerCmd.java
@@ -0,0 +1,33 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+import com.github.dockerjava.api.NotModifiedException;
+
+/**
+ * Stop a running container.
+ *
+ * @param containerId - Id of the container
+ * @param timeout - Timeout in seconds before killing the container. Defaults to 10 seconds.
+ *
+ */
+public interface StopContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public int getTimeout();
+
+ public StopContainerCmd withContainerId(String containerId);
+
+ public StopContainerCmd withTimeout(int timeout);
+
+ /**
+ * @throws NotFoundException No such container
+ * @throws NotModifiedException Container already stopped
+ */
+ @Override
+ public Void exec() throws NotFoundException, NotModifiedException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/TagImageCmd.java b/src/main/java/com/github/dockerjava/api/command/TagImageCmd.java
new file mode 100644
index 00000000..ace84996
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/TagImageCmd.java
@@ -0,0 +1,35 @@
+package com.github.dockerjava.api.command;
+
+
+/**
+ * Tag an image into a repository
+ *
+ * @param image The local image to tag (either a name or an id)
+ * @param repository The repository to tag in
+ * @param force (not documented)
+ *
+ */
+public interface TagImageCmd extends DockerCmd {
+
+ public String getImageId();
+
+ public String getRepository();
+
+ public String getTag();
+
+ public boolean hasForceEnabled();
+
+ public TagImageCmd withImageId(String imageId);
+
+ public TagImageCmd withRepository(String repository);
+
+ public TagImageCmd withTag(String tag);
+
+ public TagImageCmd withForce();
+
+ public TagImageCmd withForce(boolean force);
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/TopContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/TopContainerCmd.java
new file mode 100644
index 00000000..63865c2a
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/TopContainerCmd.java
@@ -0,0 +1,27 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * List processes running inside a container
+ */
+public interface TopContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public String getPsArgs();
+
+ public TopContainerCmd withContainerId(String containerId);
+
+ public TopContainerCmd withPsArgs(String psArgs);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public TopContainerResponse exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/TopContainerResponse.java b/src/main/java/com/github/dockerjava/api/command/TopContainerResponse.java
new file mode 100644
index 00000000..c92ffa4c
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/TopContainerResponse.java
@@ -0,0 +1,43 @@
+package com.github.dockerjava.api.command;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Joiner;
+
+/**
+ *
+ * @author marcus
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TopContainerResponse {
+
+ @JsonProperty("Titles")
+ private String[] titles;
+
+ @JsonProperty("Processes")
+ private String[][] processes;
+
+ public String[] getTitles() {
+ return titles;
+ }
+
+ public String[][] getProcesses() {
+ return processes;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[");
+ for(String[] fields: processes) {
+ buffer.append("[" + Joiner.on("; ").skipNulls().join(fields) + "]");
+ }
+ buffer.append("]");
+
+ return "TopContainerResponse{" +
+ "titles=" + Joiner.on("; ").skipNulls().join(titles) +
+ ", processes=" + buffer.toString() +
+ '}';
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/command/UnpauseContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/UnpauseContainerCmd.java
new file mode 100644
index 00000000..166bfa6a
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/UnpauseContainerCmd.java
@@ -0,0 +1,26 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Unpause a container.
+ *
+ * @param containerId - Id of the container
+ *
+ */
+public interface UnpauseContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public UnpauseContainerCmd withContainerId(String containerId);
+
+ /**
+ * @throws NotFoundException No such container
+ */
+ @Override
+ public Void exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/VersionCmd.java b/src/main/java/com/github/dockerjava/api/command/VersionCmd.java
new file mode 100644
index 00000000..740a335e
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/VersionCmd.java
@@ -0,0 +1,13 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.model.Version;
+
+/**
+ * Returns the Docker version info.
+ */
+public interface VersionCmd extends DockerCmd {
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/command/WaitContainerCmd.java b/src/main/java/com/github/dockerjava/api/command/WaitContainerCmd.java
new file mode 100644
index 00000000..e7183155
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/command/WaitContainerCmd.java
@@ -0,0 +1,25 @@
+package com.github.dockerjava.api.command;
+
+import com.github.dockerjava.api.NotFoundException;
+
+/**
+ * Wait a container
+ *
+ * Block until container stops, then returns its exit code
+ */
+public interface WaitContainerCmd extends DockerCmd {
+
+ public String getContainerId();
+
+ public WaitContainerCmd withContainerId(String containerId);
+
+ /**
+ * @throws NotFoundException container not found
+ */
+ @Override
+ public Integer exec() throws NotFoundException;
+
+ public static interface Exec extends DockerCmdExec {
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/github/dockerjava/api/model/AccessMode.java b/src/main/java/com/github/dockerjava/api/model/AccessMode.java
new file mode 100644
index 00000000..a893e7f3
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/AccessMode.java
@@ -0,0 +1,28 @@
+package com.github.dockerjava.api.model;
+
+/**
+ * The access mode of a file system or file: read-write
+ * or read-only.
+ */
+public enum AccessMode {
+ /** read-write */
+ rw,
+
+ /** read-only */
+ ro;
+
+ /**
+ * The default {@link AccessMode}: {@link #rw}
+ */
+ public static final AccessMode DEFAULT = rw;
+
+ public static final AccessMode fromBoolean(boolean accessMode) {
+ return accessMode ? rw : ro;
+ }
+
+ public final boolean toBoolean() {
+ return this.equals(AccessMode.rw) ? true: false;
+ }
+
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/model/AuthConfig.java b/src/main/java/com/github/dockerjava/api/model/AuthConfig.java
new file mode 100644
index 00000000..42c49bce
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/AuthConfig.java
@@ -0,0 +1,129 @@
+package com.github.dockerjava.api.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AuthConfig {
+
+ /**
+ * For backwards compatibility. Make sure you update the properties if you change this.
+ *
+ * @see "/docker.io.properties"
+ */
+ public static final String DEFAULT_SERVER_ADDRESS = "https://index.docker.io/v1/";
+
+ @JsonProperty
+ private String username;
+
+ @JsonProperty
+ private String password;
+
+ @JsonProperty
+ private String email;
+
+ @JsonProperty("serveraddress")
+ private String serverAddress = DEFAULT_SERVER_ADDRESS;
+
+ private String auth;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getServerAddress() {
+ return serverAddress;
+ }
+
+ public void setServerAddress(String serverAddress) {
+ this.serverAddress = serverAddress;
+ }
+
+ @JsonIgnore
+ public String getAuth() {
+ return auth;
+ }
+
+ @JsonProperty("auth")
+ public void setAuth(String auth) {
+ this.auth = auth;
+ }
+
+ @Override
+ public String toString() {
+ return "AuthConfig{" +
+ "username='" + username + '\'' +
+ ", password='" + password + '\'' +
+ ", email='" + email + '\'' +
+ ", serverAddress='" + serverAddress + '\'' +
+ '}';
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((auth == null) ? 0 : auth.hashCode());
+ result = prime * result + ((email == null) ? 0 : email.hashCode());
+ result = prime * result + ((password == null) ? 0 : password.hashCode());
+ result = prime * result + ((serverAddress == null) ? 0 : serverAddress.hashCode());
+ result = prime * result + ((username == null) ? 0 : username.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AuthConfig other = (AuthConfig) obj;
+ if (auth == null) {
+ if (other.auth != null)
+ return false;
+ } else if (!auth.equals(other.auth))
+ return false;
+ if (email == null) {
+ if (other.email != null)
+ return false;
+ } else if (!email.equals(other.email))
+ return false;
+ if (password == null) {
+ if (other.password != null)
+ return false;
+ } else if (!password.equals(other.password))
+ return false;
+ if (serverAddress == null) {
+ if (other.serverAddress != null)
+ return false;
+ } else if (!serverAddress.equals(other.serverAddress))
+ return false;
+ if (username == null) {
+ if (other.username != null)
+ return false;
+ } else if (!username.equals(other.username))
+ return false;
+ return true;
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/model/AuthConfigurations.java b/src/main/java/com/github/dockerjava/api/model/AuthConfigurations.java
new file mode 100644
index 00000000..5a62c758
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/AuthConfigurations.java
@@ -0,0 +1,21 @@
+package com.github.dockerjava.api.model;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AuthConfigurations {
+
+ @JsonProperty("configs")
+ private Map configs = new TreeMap<>();
+
+ public void addConfig(AuthConfig authConfig){
+ configs.put(authConfig.getServerAddress(), authConfig);
+ }
+
+ public Map getConfigs(){
+ return this.configs;
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/model/AuthResponse.java b/src/main/java/com/github/dockerjava/api/model/AuthResponse.java
new file mode 100644
index 00000000..cb5d9df8
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/AuthResponse.java
@@ -0,0 +1,12 @@
+package com.github.dockerjava.api.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AuthResponse {
+ @JsonProperty("Status")
+ private String status;
+
+ public String getStatus() {
+ return status;
+ }
+}
diff --git a/src/main/java/com/github/dockerjava/api/model/Bind.java b/src/main/java/com/github/dockerjava/api/model/Bind.java
new file mode 100644
index 00000000..0071bff9
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/Bind.java
@@ -0,0 +1,102 @@
+package com.github.dockerjava.api.model;
+
+
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+/**
+ * Represents a host path being bind mounted as a {@link Volume}
+ * in a Docker container.
+ * The Bind can be in read only or read write access mode.
+ */
+public class Bind {
+
+ private String path;
+
+ private Volume volume;
+
+ private AccessMode accessMode;
+
+ public Bind(String path, Volume volume) {
+ this(path, volume, AccessMode.DEFAULT);
+ }
+
+ public Bind(String path, Volume volume, AccessMode accessMode) {
+ this.path = path;
+ this.volume = volume;
+ this.accessMode = accessMode;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public Volume getVolume() {
+ return volume;
+ }
+
+ public AccessMode getAccessMode() {
+ return accessMode;
+ }
+
+
+ /**
+ * Parses a bind mount specification to a {@link Bind}.
+ *
+ * @param serialized the specification, e.g. /host:/container:ro
+ * @return a {@link Bind} matching the specification
+ * @throws IllegalArgumentException if the specification cannot be parsed
+ */
+ public static Bind parse(String serialized) {
+ try {
+ String[] parts = serialized.split(":");
+ switch (parts.length) {
+ case 2: {
+ return new Bind(parts[0], new Volume(parts[1]));
+ }
+ case 3: {
+ AccessMode accessMode = AccessMode.valueOf(parts[2].toLowerCase());
+ return new Bind(parts[0], new Volume(parts[1]), accessMode);
+ }
+ default: {
+ throw new IllegalArgumentException();
+ }
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Error parsing Bind '" + serialized
+ + "'");
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Bind) {
+ Bind other = (Bind) obj;
+ return new EqualsBuilder().append(path, other.getPath())
+ .append(volume, other.getVolume())
+ .append(accessMode, other.getAccessMode()).isEquals();
+ } else
+ return super.equals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(path).append(volume)
+ .append(accessMode).toHashCode();
+ }
+
+ /**
+ * Returns a string representation of this {@link Bind} suitable
+ * for inclusion in a JSON message.
+ * The format is <host path>:<container path>:<access mode>,
+ * like the argument in {@link #parse(String)}.
+ *
+ * @return a string representation of this {@link Bind}
+ */
+ @Override
+ public String toString() {
+ return path + ":" + volume.getPath() + ":" + accessMode.toString();
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/model/Binds.java b/src/main/java/com/github/dockerjava/api/model/Binds.java
new file mode 100644
index 00000000..bfc8dbf2
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/Binds.java
@@ -0,0 +1,73 @@
+package com.github.dockerjava.api.model;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.node.NullNode;
+
+
+@JsonSerialize(using = Binds.Serializer.class)
+@JsonDeserialize(using = Binds.Deserializer.class)
+public class Binds {
+
+ private Bind[] binds;
+
+ public Binds(Bind... binds) {
+ this.binds = binds;
+ }
+
+ public Bind[] getBinds() {
+ return binds;
+ }
+
+ public static class Serializer extends JsonSerializer {
+
+ @Override
+ public void serialize(Binds binds, JsonGenerator jsonGen,
+ SerializerProvider serProvider) throws IOException,
+ JsonProcessingException {
+
+ //
+ jsonGen.writeStartArray();
+ for (Bind bind : binds.getBinds()) {
+ jsonGen.writeString(bind.toString());
+ }
+ jsonGen.writeEndArray();
+ //
+ }
+
+ }
+
+ public static class Deserializer extends JsonDeserializer {
+ @Override
+ public Binds deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+
+ List binds = new ArrayList();
+ ObjectCodec oc = jsonParser.getCodec();
+ JsonNode node = oc.readTree(jsonParser);
+ for (Iterator> it = node.fields(); it.hasNext();) {
+
+ Map.Entry field = it.next();
+ if (!field.getValue().equals(NullNode.getInstance())) {
+ binds.add(Bind.parse(field.getKey()));
+ }
+ }
+ return new Binds(binds.toArray(new Bind[0]));
+ }
+ }
+
+}
diff --git a/src/main/java/com/github/dockerjava/api/model/Capability.java b/src/main/java/com/github/dockerjava/api/model/Capability.java
new file mode 100644
index 00000000..c86c0796
--- /dev/null
+++ b/src/main/java/com/github/dockerjava/api/model/Capability.java
@@ -0,0 +1,329 @@
+package com.github.dockerjava.api.model;
+
+/**
+ * The Linux capabilities supported by Docker.
+ * The list of capabilities is defined in Docker's types.go,
+ * {@link #ALL} was added manually.
+ *
+ * @see http://man7.org/linux/man-pages/man7/capabilities.7.html
+ */
+public enum Capability {
+ /**
+ * This meta capability includes all Linux capabilities.
+ */
+ ALL,
+ /**
+ *
+ *
Enable and disable kernel auditing.
+ *
Change auditing filter rules.
+ *
Retrieve auditing status and filtering rules.
+ *
+ */
+ AUDIT_CONTROL,
+ /**
+ * Write records to kernel auditing log.
+ */
+ AUDIT_WRITE,
+ /**
+ * Employ features that can block system suspend.
+ */
+ BLOCK_SUSPEND,
+ /**
+ * Make arbitrary changes to file UIDs and GIDs (see chown(2)).
+ */
+ CHOWN,
+ /**
+ * Bypass file read, write, and execute permission checks.
+ * (DAC is an abbreviation of "discretionary access control".)
+ */
+ DAC_OVERRIDE,
+ /**
+ * Bypass file read permission checks and directory read and
+ * execute permission checks.
+ */
+ DAC_READ_SEARCH,
+ /**
+ *
+ *
Bypass permission checks on operations that normally require
+ * the file system UID of the process to match the UID of the file
+ * (e.g., chmod(2), utime(2)), excluding those operations covered
+ * by the {@link #DAC_OVERRIDE} and{@link #DAC_READ_SEARCH}.
+ *
Set extended file attributes (see chattr(1)) on arbitrary files.
+ *
Set Access Control Lists (ACLs) on arbitrary files.
+ *
Ignore directory sticky bit on file deletion.
+ *
Specify O_NOATIME for arbitrary files in open(2)and fcntl(2).
+ *
+ */
+ FOWNER,
+ /**
+ *
+ *
Don't clear set-user-ID and set-group-ID permission bits when
+ * a file is modified.
+ *
Set the set-group-ID bit for a file whose GID does not match
+ * the file system or any of the supplementary GIDs of the calling
+ * process.
+ *
+ */
+ FSETID,
+ /**
+ * Permit memory locking (mlock(2), mlockall(2), mmap(2), shmctl(2)).
+ */
+ IPC_LOCK,
+ /**
+ * Bypass permission checks for operations on System V IPC objects.
+ */
+ IPC_OWNER,
+ /**
+ * Bypass permission checks for sending signals (see kill(2)).
+ * This includes use of the ioctl(2) KDSIGACCEPT operation.
+ */
+ KILL,
+ /**
+ * Establish leases on arbitrary files (see fcntl(2)).
+ */
+ LEASE,
+ /**
+ * Set the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags (see chattr(1)).
+ */
+ LINUX_IMMUTABLE,
+ /**
+ * Override Mandatory Access Control (MAC).
+ * Implemented for the Smack Linux Security Module (LSM).
+ */
+ MAC_ADMIN,
+ /**
+ * Allow MAC configuration or state changes. Implemented for the Smack LSM.
+ */
+ MAC_OVERRIDE,
+ /**
+ * Create special files using mknod(2).
+ */
+ MKNOD,
+ /**
+ * Perform various network-related operations:
+ *
+ *
Interface configuration.
+ *
Administration of IP firewall, masquerading, and accounting.
+ *
Modify routing tables.
+ *
Bind to any address for transparent proxying.
+ *
Set type-of-service (TOS).
+ *
Clear driver statistics.
+ *
Set promiscuous mode.
+ *
Enabling multicasting.
+ *
Use setsockopt(2) to set the following socket options: SO_DEBUG,
+ * SO_MARK, SO_PRIORITY (for a priority outside the range 0 to 6),
+ * SO_RCVBUFFORCE, and SO_SNDBUFFORCE.
+ *
+ */
+ NET_ADMIN,
+ /**
+ * Bind a socket to Internet domain privileged ports (port numbers less
+ * than 1024).
+ */
+ NET_BIND_SERVICE,
+ /**
+ * (Unused) Make socket broadcasts, and listen to multicasts.
+ */
+ NET_BROADCAST,
+ /**
+ *
Make arbitrary manipulations of process GIDs and supplementary
+ * GID list.
+ *
Forge GID when passing socket credentials via UNIX domain
+ * sockets.
+ *
+ */
+ SETGID,
+ /**
+ * If file capabilities are not supported:
+ *
+ *
grant or remove any capability in the caller's permitted
+ * capability set to or from any other process. (This property of
+ * CAP_SETPCAP is not available when the kernel is configured to
+ * support file capabilities, since CAP_SETPCAP has entirely different
+ * semantics for such kernels.)
+ *
+ *
+ * If file capabilities are supported:
+ *
+ *
Add any capability from the calling thread's bounding set to its
+ * inheritable set.
+ *
Drop capabilities from the bounding set (via prctl(2)
+ * PR_CAPBSET_DROP).
+ *
Make changes to the securebits flags.
+ *
+ */
+ SETPCAP,
+ /**
+ *
+ *
Make arbitrary manipulations of process UIDs (setuid(2),
+ * setreuid(2), setresuid(2), setfsuid(2)).
+ *
Make forged UID when passing socket credentials via UNIX domain
+ * sockets.
+ *
+ */
+ SETUID,
+ /**
+ *
+ *
Perform a range of system administration operations including:
+ * quotactl(2), mount(2), umount(2), swapon(2), swapoff(2), sethostname(2),
+ * and setdomainname(2).
+ *
Perform privileged syslog(2) operations (since Linux 2.6.37,
+ * CAP_SYSLOG should be used to permit such operations).
+ *
Perform VM86_REQUEST_IRQ vm86(2) command.
+ *
Perform IPC_SET and IPC_RMID operations on arbitrary System V IPC objects.
+ *
Perform operations on trusted and security Extended Attributes
+ * (see attr(5)).
+ *
Use lookup_dcookie(2)
+ *
Use ioprio_set(2) to assign IOPRIO_CLASS_RT and (before Linux 2.6.25)
+ * IOPRIO_CLASS_IDLE I/O scheduling classes.
+ *
Forge UID when passing socket credentials.
+ *
Exceed /proc/sys/fs/file-max, the system-wide limit on the number of
+ * open files, in system calls that open files (e.g., accept(2), execve(2),
+ * open(2), pipe(2)).
+ *
Employ CLONE_* flags that create new namespaces with clone(2) and
+ * unshare(2).
+ *
Call perf_event_open(2).
+ *
Access privileged perf event information.
+ *
Call setns(2).
+ *
Call fanotify_init(2).
+ *
Perform KEYCTL_CHOWN and KEYCTL_SETPERM keyctl(2) operations.
+ *
Perform madvise(2) MADV_HWPOISON operation.
+ *
Employ the TIOCSTI ioctl(2) to insert characters into the input queue
+ * of a terminal other than the caller's controlling terminal.
+ *
Employ the obsolete nfsservctl(2) system call.
+ *
Employ the obsolete bdflush(2) system call.
+ *
Perform various privileged block-device ioctl(2) operations.
+ *
Perform various privileged file-system ioctl(2) operations.
+ *
Perform administrative operations on many device drivers.
+ *
+ */
+ SYS_ADMIN,
+ /**
+ * Use reboot(2) and kexec_load(2).
+ */
+ SYS_BOOT,
+ /**
+ * Use chroot(2).
+ */
+ SYS_CHROOT,
+ /**
+ *
+ *
Perform privileged syslog(2) operations. See syslog(2) for information
+ * on which operations require privilege.
+ *
View kernel addresses exposed via /proc and other interfaces when
+ * /proc/sys/kernel/kptr_restrict has the value 1. (See the discussion of the
+ * kptr_restrict in proc(5).)
+ *
+ */
+ SYSLOG,
+ /**
+ *
+ *
Load and unload kernel modules (see init_module(2) and delete_module(2))
+ *
In kernels before 2.6.25: drop capabilities from the system-wide
+ * capability bounding set.
+ *
+ */
+ SYS_MODULE,
+ /**
+ *
+ *
Raise process nice value (nice(2), setpriority(2)) and change the nice
+ * value for arbitrary processes.
+ *
Set real-time scheduling policies for calling process, and set scheduling
+ * policies and priorities for arbitrary processes (sched_setscheduler(2),
+ * sched_setparam(2)).
+ *
Set CPU affinity for arbitrary processes (sched_setaffinity(2)).
+ *
Set I/O scheduling class and priority for arbitrary processes
+ * (ioprio_set(2)).
+ *
Apply migrate_pages(2) to arbitrary processes and allow processes to be
+ * migrated to arbitrary nodes.
+ *
Apply move_pages(2) to arbitrary processes.
+ *
Use the MPOL_MF_MOVE_ALL flag with mbind(2) and move_pages(2).
+ *