Skip to content

Commit 4217eeb

Browse files
committed
Merge pull request docker-java#1 from docker-java/master
Merge from upstream
2 parents 685819a + 155f24c commit 4217eeb

358 files changed

Lines changed: 17585 additions & 5875 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/
2+
target/

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: java
2+
jdk:
3+
- oraclejdk7
4+
after_success:
5+
- echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
6+
- mvn deploy -DskipITs --settings ~/settings.xml

CHANGELOG.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
Change Log
2+
===
3+
Latest SNAPSHOT
4+
---
5+
* [#180](https://github.com/docker-java/docker-java/pull/180) Dockerfiles not called 'dockerfile'
6+
* [#179](https://github.com/docker-java/docker-java/pull/179) Add support for cpuset in CreateContainerCmd
7+
* [#170](https://github.com/docker-java/docker-java/pull/170) Allow to specify alternative files other than 'Dockerfile' for building images
8+
* [#165](https://github.com/docker-java/docker-java/pull/165) PushImageCmd assumes that you have an auth config setup
9+
* [#161](https://github.com/docker-java/docker-java/pull/161) Inspect exec command
10+
* [#159](https://github.com/docker-java/docker-java/pull/159) Add missing Info fields
11+
* [#156](https://github.com/docker-java/docker-java/pull/156) Add support for configuring ExtraHosts
12+
* [#146](https://github.com/docker-java/docker-java/pull/146) Create Identifier type
13+
14+
15+
v1.0.0
16+
---
17+
* [#152](https://github.com/docker-java/docker-java/pull/152) Restore guava as a dependency
18+
* [#149](https://github.com/docker-java/docker-java/pull/149) Handle HTTP-Redirects
19+
* [#148](https://github.com/docker-java/docker-java/pull/148) Save image functionality
20+
* [#142](https://github.com/docker-java/docker-java/pull/142) Reduce Logging Level
21+
* [#138](https://github.com/docker-java/docker-java/pull/138) Apache CXF interopabilty
22+
* [#137](https://github.com/docker-java/docker-java/pull/137) Multiple volumesFrom option when creating a container
23+
* [#135](https://github.com/docker-java/docker-java/pull/135) Update to latest unix-socket-factory
24+
* [#134](https://github.com/docker-java/docker-java/pull/134) Remove Google Guava as dependency
25+
* [#131](https://github.com/docker-java/docker-java/pull/128) Utility classes and streamed JSON representations
26+
* [#128](https://github.com/docker-java/docker-java/pull/128) Allow unauthorized pullImageCmd
27+
28+
v0.10.5
29+
---
30+
* [#125](https://github.com/docker-java/docker-java/pull/125) Unixsocket support
31+
* [#123](https://github.com/docker-java/docker-java/pull/123) support DOCKER_TLS_VERIFY to detect ssl
32+
* [#121](https://github.com/docker-java/docker-java/pull/121) Implemented support for commands: Exec-start, Exec-create
33+
* [#120](https://github.com/docker-java/docker-java/pull/120) Command resource cleanup after command execution
34+
* [#118](https://github.com/docker-java/docker-java/pull/118) Use chunked encoding when passing the docker image
35+
* [#116](https://github.com/docker-java/docker-java/pull/116) Allow SSL configuration from pre-existing keystore to be used
36+
* [#115](https://github.com/docker-java/docker-java/pull/115) Polish RestartPolicy
37+
* [#114](https://github.com/docker-java/docker-java/pull/114) Fix CreateContainerCmdImpl.withVolumesFrom()
38+
* [#111](https://github.com/docker-java/docker-java/pull/111) Allow to send empty messages in StartContainerCmd
39+
40+
v0.10.4
41+
---
42+
43+
* [#109](https://github.com/docker-java/docker-java/pull/109) Support tag in push image command
44+
* [#106](https://github.com/docker-java/docker-java/pull/106) Allow to manage Linux capabilities in CreateContainerCmd
45+
* [#105](https://github.com/docker-java/docker-java/pull/105) Allow to pass HostConfig when creating a container
46+
* [#103](https://github.com/docker-java/docker-java/pull/103) Make GoLangMatchFileFilter work on Windows
47+
* [#102](https://github.com/docker-java/docker-java/pull/102) Downgraded jackson-jaxrs dependency version
48+
* [#101](https://github.com/docker-java/docker-java/pull/101) list filtered images as described in the remote api docs
49+
* [#100](https://github.com/docker-java/docker-java/pull/100) Add support for .dockercfg files to handle auth for push command
50+
* [#95](https://github.com/docker-java/docker-java/pull/95) Add support for .dockerignore files
51+
* [#92](https://github.com/docker-java/docker-java/pull/92) Add travis-ci support
52+
* [#90](https://github.com/docker-java/docker-java/pull/90) Update DockerClientBuilder.java
53+
* [#88](https://github.com/docker-java/docker-java/pull/88) Add support for private repositories and pull/push authentication
54+
55+
v0.10.3
56+
---
57+
58+
* [#87](https://github.com/docker-java/docker-java/pull/87) Improve adding of port bindings
59+
* [#83](https://github.com/docker-java/docker-java/pull/83) Loading of custom DockerCmdExecFactory
60+
* [#81](https://github.com/docker-java/docker-java/pull/81) Env config
61+
* [#82](https://github.com/docker-java/docker-java/pull/82) Allow multiple port bindings per ExposedPort
62+
* [#80](https://github.com/docker-java/docker-java/pull/80) explicitly use the latest image version
63+
* [#79](https://github.com/docker-java/docker-java/pull/79) Move slow tests to integration test phase, enable tests by default
64+
* [#76](https://github.com/docker-java/docker-java/pull/76) New enum \"InternetProtocol\" for supported IP protocols replaces \"scheme\"
65+
* [#75](https://github.com/docker-java/docker-java/pull/75) Use ExposedPort.toString() in serialization
66+
* [#74](https://github.com/docker-java/docker-java/pull/74) Use project.build.sourceEncoding in compiler
67+
* [#73](https://github.com/docker-java/docker-java/pull/73) Improve parsing and serialization of Link
68+
* [#70](https://github.com/docker-java/docker-java/pull/70) Improve instantiation and serialization of Bind
69+
70+
v0.10.2
71+
---
72+
73+
* [#69](https://github.com/docker-java/docker-java/pull/69) Use canonical form of Docker folder when building TAR files
74+
* [#68](https://github.com/docker-java/docker-java/pull/68) Set Jersey client CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE
75+
* [#67](https://github.com/docker-java/docker-java/pull/67) typo in README.md
76+
* [#65](https://github.com/docker-java/docker-java/pull/65) Added static method udp in ExposedPort
77+
* [#63](https://github.com/docker-java/docker-java/pull/63) Bind.parse() fails when access mode is specified
78+
* [#57](https://github.com/docker-java/docker-java/pull/57) Add streaming events API
79+
* [#59](https://github.com/docker-java/docker-java/pull/59) Update readme to include corrected api example
80+
* [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
81+
* [#56](https://github.com/docker-java/docker-java/pull/56) Update README.md
82+
* [#58](https://github.com/docker-java/docker-java/pull/58) Code clear and bug fix
83+
84+
v0.10.1
85+
---
86+
87+
* [#49](https://github.com/docker-java/docker-java/pull/49) Allow user to check where volume is binded on host
88+
* [#47](https://github.com/docker-java/docker-java/pull/47) let CompressArchiveUtil preserve executable flags
89+
* [#46](https://github.com/docker-java/docker-java/pull/46) Fixes to AttachContainerCmd and CreateContainerCmd.
90+
91+
v0.10.0
92+
---
93+
94+
* [#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...
95+
* [#38](https://github.com/docker-java/docker-java/pull/38) Remove special-case for one \":\" from PullCommand
96+
* [#37](https://github.com/docker-java/docker-java/pull/37) Starts v0.10.0
97+
* [#35](https://github.com/docker-java/docker-java/pull/35) Exposing the withTTY method for container creation.
98+
99+
v0.9.1
100+
---
101+
102+
* [#31](https://github.com/docker-java/docker-java/pull/31) Change VolumesFrom to handle array
103+
* [#29](https://github.com/docker-java/docker-java/pull/29) Makes Config a public, immutable class with a builder
104+
* [#22](https://github.com/docker-java/docker-java/pull/22) Fixes for startContainerCmd
105+
* [#19](https://github.com/docker-java/docker-java/pull/19) Add missing options to BuildCmd and set them to match Docker client.
106+
* [#16](https://github.com/docker-java/docker-java/pull/16) Build image improvements
107+
108+
v0.9.0
109+
---
110+
111+
* [#14](https://github.com/docker-java/docker-java/pull/14) Use RegEx to match ADD command from Dockerfile.
112+
* [#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.
113+
114+
v0.8.2
115+
---
116+
117+
* [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
118+
* [#1](https://github.com/docker-java/docker-java/pull/1) Merge
119+
* [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
120+
* [#66](https://github.com/docker-java/docker-java/pull/66) Backport the new structure to Jersey 1.18
121+
* [#65](https://github.com/docker-java/docker-java/pull/65) Added static method udp in ExposedPort
122+
* [#61](https://github.com/docker-java/docker-java/pull/61)
123+
* [#60](https://github.com/docker-java/docker-java/pull/60) Added additional callback methods to EventCallback
124+
* [#1](https://github.com/docker-java/docker-java/pull/1) Merge
125+
* [#55](https://github.com/docker-java/docker-java/pull/55)
126+
* [#58](https://github.com/docker-java/docker-java/pull/58) Code clear and bug fix
127+
* [#54](https://github.com/docker-java/docker-java/pull/54)
128+
* [#3](https://github.com/docker-java/docker-java/pull/3)
129+
* [#2](https://github.com/docker-java/docker-java/pull/2) Move to new maven coordinate com.github.docker-java:docker-java
130+
* [#1](https://github.com/docker-java/docker-java/pull/1) Merge
131+
* [#34](https://github.com/docker-java/docker-java/pull/34)
132+
* [#36](https://github.com/docker-java/docker-java/pull/36)
133+
* [#37](https://github.com/docker-java/docker-java/pull/37) Starts v0.10.0
134+
* [#32](https://github.com/docker-java/docker-java/pull/32)
135+
136+
v0.8.1
137+
---
138+
139+
140+
v0.8.1
141+
---
142+
143+
* [#28](https://github.com/docker-java/docker-java/pull/28) Improves use of docker-java in unit tests
144+
* [#30](https://github.com/docker-java/docker-java/pull/30) Add ping method
145+
* [#27](https://github.com/docker-java/docker-java/pull/27) Added a close method to DockerClient
146+
* [#26](https://github.com/docker-java/docker-java/pull/26)
147+
* [#24](https://github.com/docker-java/docker-java/pull/24)
148+
* [#23](https://github.com/docker-java/docker-java/pull/23)
149+
* [#22](https://github.com/docker-java/docker-java/pull/22) Fixes for startContainerCmd
150+
* [#20](https://github.com/docker-java/docker-java/pull/20)
151+
* [#19](https://github.com/docker-java/docker-java/pull/19) Add missing options to BuildCmd and set them to match Docker client.
152+
* [#18](https://github.com/docker-java/docker-java/pull/18) Added Container-Linking
153+
* [#16](https://github.com/docker-java/docker-java/pull/16) Build image improvements
154+
* [#15](https://github.com/docker-java/docker-java/pull/15) Collection of changes driven by use in gradle-docker and on Windows
155+
* [#14](https://github.com/docker-java/docker-java/pull/14) Use RegEx to match ADD command from Dockerfile.
156+
* [#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.
157+
* [#5](https://github.com/docker-java/docker-java/pull/5) add paused field in ContainerInspectResponse
158+
* [#6](https://github.com/docker-java/docker-java/pull/6)

README.md

Lines changed: 84 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,140 @@
1-
# docker-java
1+
[![Build Status](https://travis-ci.org/docker-java/docker-java.svg?branch=master)](https://travis-ci.org/docker-java/docker-java)
2+
[![Circle CI](https://circleci.com/gh/docker-java/docker-java.svg?style=svg)](https://circleci.com/gh/docker-java/docker-java)
3+
# docker-java
24

35
Java API client for [Docker](http://docs.docker.io/ "Docker")
46

5-
Supports a subset of the Docker Client API v1.13, Docker Server version 1.1
7+
Supports a subset of the Docker Client API v1.16, Docker Server version 1.4.1
8+
9+
<b>The current implementation is based on Jersey 2.x and therefore classpath incompatible with older Jersey 1.x dependent libraries!</b>
610

711
Developer forum for [docker-java](https://groups.google.com/forum/?hl=de#!forum/docker-java-dev "docker-java")
812

913
## Build with Maven
1014

1115
###### Prerequisites:
1216

13-
* Java 1.6+
17+
* Java 1.7
1418
* Maven 3.0.5
1519
* Docker daemon running
1620

17-
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:
21+
If you need SSL, then you'll need to put your `*.pem` file into `~/.docker/`, if you're using boot2docker, do this:
22+
23+
$ ln -s /Users/alex.collins/.boot2docker/certs/boot2docker-vm .docker
24+
25+
Build and run integration tests as follows:
26+
27+
$ mvn clean install
1828

19-
$ mvn clean install -DskipTests=false -Ddocker.io.username=... -Ddocker.io.password=... -Ddocker.io.email=...
29+
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:
30+
31+
$ mvn clean install -DskipITs
2032

2133
By default Docker server is using UNIX sockets for communication with the Docker client, however docker-java
22-
client uses TCP/IP to connect to the Docker server, so you will need to make sure that your Docker server is
34+
client uses TCP/IP to connect to the Docker server by default, so you will need to make sure that your Docker server is
2335
listening on TCP port. To allow Docker server to use TCP add the following line to /etc/default/docker
2436

2537
DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"
2638

27-
More details setting up docket server can be found in official documentation: http://docs.docker.io/en/latest/use/basics/
39+
However you can force docker-java to use UNIX socket communication by configure the following url:
40+
41+
unix:///var/run/docker.sock
42+
43+
More details setting up Docker server can be found in official documentation: http://docs.docker.io/en/latest/use/basics/
2844

2945
Now make sure that docker is up:
3046

3147
$ docker -H tcp://127.0.0.1:2375 version
3248

3349
Client version: 0.8.0
34-
Go version (client): go1.2
35-
Git commit (client): cc3a8c8
36-
Server version: 1.0.0
37-
Git commit (server): 63fe64c
38-
Go version (server): go1.2.1
50+
Go version (client): go1.2
51+
Git commit (client): cc3a8c8
52+
Server version: 1.2.0
53+
Git commit (server): fa7b24f
54+
Go version (server): go1.3.1
55+
56+
Run build without integration tests:
3957

40-
Run build with tests:
58+
$ mvn clean install -DskipITs
4159

42-
$ mvn clean install -DskipTests=false
60+
## Docker-Java maven dependencies
4361

44-
## Docker-Java maven dependency:
62+
### Latest release version
4563

4664
<dependency>
4765
<groupId>com.github.docker-java</groupId>
4866
<artifactId>docker-java</artifactId>
49-
<version>0.9.1</version>
67+
<version>1.0.0</version>
5068
</dependency>
5169

52-
Latest SNAPSHOT is available from maven repo: https://oss.sonatype.org/content/groups/public
70+
### Latest SNAPSHOT version
71+
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/).
72+
73+
74+
<dependency>
75+
<groupId>com.github.docker-java</groupId>
76+
<artifactId>docker-java</artifactId>
77+
<version>1.0.1-SNAPSHOT</version>
78+
</dependency>
5379

5480
## Documentation
5581

56-
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/client/command "Test cases")
82+
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")
5783

5884
## Configuration
5985

6086
There are a couple of configuration items, all of which have sensible defaults:
6187

62-
* `url` The Docker URL, e.g. `http://localhost:2375`.
63-
* `version` The API version, e.g. `1.13`.
64-
* `username` Your repository username (required to push containers).
65-
* `password` Your repository password.
66-
* `email` Your repository email.
88+
* `url` The Docker URL, e.g. `https://localhost:2376` or `unix:///var/run/docker.sock`
89+
* `version` The API version, e.g. `1.16`.
90+
* `username` Your registry username (required to push containers).
91+
* `password` Your registry password.
92+
* `email` Your registry email.
93+
* `serverAddress` Your registry's address.
94+
* `dockerCertPath` Path to the docker certs.
6795

6896
There are three ways to configure, in descending order of precedence:
6997

70-
##### Programatic:
98+
#### Programmatic:
7199
In your application, e.g.
72100

73-
DockerClient docker = new DockerClient("http://localhost:2375");
74-
docker.setCredentials("dockeruser", "ilovedocker", "dockeruser@github.com");`
101+
DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder()
102+
.withVersion("1.16")
103+
.withUri("https://my-docker-host.tld:2376")
104+
.withUsername("dockeruser")
105+
.withPassword("ilovedocker")
106+
.withEmail("dockeruser@github.com")
107+
.withServerAddress("https://index.docker.io/v1/")
108+
.withDockerCertPath("/home/user/.docker")
109+
.build();
110+
DockerClient docker = DockerClientBuilder.getInstance(config).build();
111+
112+
#### Properties
113+
114+
docker.io.url=https://localhost:2376
115+
docker.io.version=1.16
116+
docker.io.username=dockeruser
117+
docker.io.password=ilovedocker
118+
docker.io.email=dockeruser@github.com
119+
docker.io.serverAddress=https://index.docker.io/v1/
120+
docker.io.dockerCertPath=/home/user/.docker
121+
75122

76123
##### System Properties:
77-
E.g.
78124

79-
java -Ddocker.io.username=kpelykh pkg.Main
125+
java -Ddocker.io.username=dockeruser pkg.Main
80126

81-
##### File System
82-
In `$HOME/.docker.io.properties`, e.g.:
127+
##### System Environment
83128

84-
docker.io.username=dockeruser
129+
export DOCKER_URL=http://localhost:2376
130+
131+
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.
132+
133+
##### File System
134+
135+
In `$HOME/.docker.io.properties`
85136

86137
##### Class Path
87-
In the class path at `/docker.io.properties`, e.g.:
88138

89-
docker.io.url=http://localhost:2375
90-
docker.io.version=1.13
139+
In the class path at `/docker.io.properties`
140+

circle.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# docker-java on circleCI
2+
3+
The build including tests and integration tests can be automatically run on [circleCI](https://circleci.com/).
4+
5+
## Setup
6+
1. create an account on circle CI using your github account.
7+
2. select docker-java from the github projects listed in your profile.
8+
3. go to the project settings for docker-java (click on the gear-wheel icon beside the docker-java title).
9+
4. open the *Environment variable* page.
10+
5. add the following environment variables:
11+
- DOCKER_EMAIL
12+
- DOCKER_PASSWORD
13+
- DOCKER_USERNAME
14+
15+
## Ignored Tests
16+
ExecCreateCmdImplTest.execCreateTest
17+
18+
- Exec is not supported by the lxc driver
19+
20+
ExecStartCmdImplTest.execStartTest
21+
22+
- Exec is not supported by the lxc driver
23+
24+
KillContainerCmdImplTest.killContainer
25+
26+
- Killed container has ExitCode 0
27+
28+
ListImagesCmdImplTest.listDanglingImages
29+
30+
- caused by [docker#9939](https://github.com/docker/docker/issues/9939)
31+
32+
RemoveContainerCmdImplTest.removeContainer
33+
34+
- caused by [docker#9939](https://github.com/docker/docker/issues/9939)
35+
36+
RemoveImageCmdImplTest.removeImage
37+
38+
- caused by [docker#9939](https://github.com/docker/docker/issues/9939)
39+
40+
ContainerDiffCmdImplTest.testContainerDiff
41+
42+
- 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"} ]
43+
44+
BuildImageCmdImplTest.testDockerIgnore
45+
46+
- ignore is not working
47+
48+
StopContainerCmdImplTest.testStopContainer
49+
50+
- Stopped container has ExitCode 0
51+

0 commit comments

Comments
 (0)