Skip to content

Commit 605d639

Browse files
committed
Update README to reflect API changes
1 parent e2ffbd6 commit 605d639

1 file changed

Lines changed: 22 additions & 26 deletions

File tree

README.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
Supports a subset of the Docker Client API v1.11, Docker Server version 0.11
5+
Supports a subset of the Docker Client API v1.12, Docker Server version 1.0
66

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

@@ -22,62 +22,58 @@ By default Docker server is using UNIX sockets for communication with the Docker
2222
client uses TCP/IP to connect to the Docker server, so you will need to make sure that your Docker server is
2323
listening on TCP port. To allow Docker server to use TCP add the following line to /etc/default/docker
2424

25-
DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock"
25+
DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"
2626

2727
More details setting up docket server can be found in official documentation: http://docs.docker.io/en/latest/use/basics/
2828

2929
Now make sure that docker is up:
3030

31-
$ docker -H tcp://127.0.0.1:4243 version
31+
$ docker -H tcp://127.0.0.1:2375 version
3232

33-
Client version: 0.8.1
33+
Client version: 0.8.0
3434
Go version (client): go1.2
35-
Git commit (client): a1598d1
36-
Server version: 0.8.1
37-
Git commit (server): a1598d1
38-
Go version (server): go1.2
39-
Last stable version: 0.8.1
35+
Git commit (client): cc3a8c8
36+
Server version: 1.0.0
37+
Git commit (server): 63fe64c
38+
Go version (server): go1.2.1
4039

4140
Run build with tests:
4241

43-
$ mvn clean install
42+
$ mvn clean install -DskipTests=false
4443

4544
## Docker-Java maven dependency:
4645

4746
<dependency>
4847
<groupId>com.github.docker-java</groupId>
4948
<artifactId>docker-java</artifactId>
50-
<version>0.8.2</version>
49+
<version>0.9.0-SNAPSHOT</version>
5150
</dependency>
5251

5352
Latest SNAPSHOT is available from maven repo: https://oss.sonatype.org/content/groups/public
5453

5554
## Example code snippets:
5655

57-
DockerClient dockerClient = new DockerClient("http://localhost:4243");
56+
DockerClient dockerClient = new DockerClient("http://localhost:2375");
5857

5958
###### Get Docker info:
6059

61-
Info info = dockerClient.info();
60+
Info info = dockerClient.infoCmd().exec();
6261
System.out.print(info);
6362

6463
###### Search Docker repository:
6564

66-
List<SearchItem> dockerSearch = dockerClient.search("busybox");
65+
List<SearchItem> dockerSearch = dockerClient.searchImagesCmd("busybox").exec();
6766
System.out.println("Search returned" + dockerSearch.toString());
6867

6968
###### Create new Docker container, wait for its start and stop it:
7069

71-
ContainerConfig containerConfig = new ContainerConfig();
72-
containerConfig.setImage("busybox");
73-
containerConfig.setCmd(new String[] {"touch", "/test"});
74-
ContainerCreateResponse container = dockerClient.createContainer(containerConfig);
70+
ContainerCreateResponse container = dockerClient.createContainerCmd("busybox").withCmd("touch", "/test").exec();
7571

76-
dockerClient.startContainer(container.id);
72+
dockerClient.startContainerCmd(container.id).exec();
7773

78-
dockerClient.waitContainer(container.id);
74+
dockerClient.waitContainerCmd(container.id).exec();
7975

80-
dockerClient.stopContainer(container.id);
76+
dockerClient.stopContainerCmd(container.id).exec();
8177

8278

8379
##### Support for UNIX sockets:
@@ -92,7 +88,7 @@ user dockerClient.build(baseDir), where baseDir is a path to folder containing D
9288

9389
File baseDir = new File("~/kpelykh/docker/netcat");
9490

95-
ClientResponse response = dockerClient.build(baseDir);
91+
ClientResponse response = dockerClient.buildImageCmd(baseDir).exec();
9692

9793
StringWriter logwriter = new StringWriter();
9894

@@ -115,8 +111,8 @@ For additional examples, please look at [DockerClientTest.java](https://github.c
115111

116112
There are a couple of configuration items, all of which have sensible defaults:
117113

118-
* `url` The Docker URL, e.g. `http://localhost:4243`.
119-
* `version` The API version, e.g. `1.11`.
114+
* `url` The Docker URL, e.g. `http://localhost:2375`.
115+
* `version` The API version, e.g. `1.12`.
120116
* `username` Your repository username (required to push containers).
121117
* `password` Your repository password.
122118
* `email` Your repository email.
@@ -126,7 +122,7 @@ There are three ways to configure, in descending order of precedence:
126122
##### Programatic:
127123
In your application, e.g.
128124

129-
DockerClient docker = new DockerClient("http://localhost:4243");
125+
DockerClient docker = new DockerClient("http://localhost:2375");
130126
docker.setCredentials("dockeruser", "ilovedocker", "dockeruser@github.com");`
131127

132128
##### System Properties:
@@ -142,5 +138,5 @@ In `$HOME/.docker.io.properties`, e.g.:
142138
##### Class Path
143139
In the class path at `/docker.io.properties`, e.g.:
144140

145-
docker.io.url=http://localhost:4243
141+
docker.io.url=http://localhost:2375
146142
docker.io.version=1.11

0 commit comments

Comments
 (0)