Skip to content

Commit 9cf0799

Browse files
author
alex.collins
committed
README update
1 parent 3fcf3d7 commit 9cf0799

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ listening on TCP port. To allow Docker server to use TCP add the following line
3131
More details setting up docket server can be found in official documentation: http://docs.docker.io/en/latest/use/basics/
3232

3333
Now make sure that docker is up:
34-
34+
3535
$ docker -H tcp://127.0.0.1:4243 version
3636

3737
Client version: 0.8.1
@@ -63,12 +63,12 @@ Run build with tests:
6363

6464
Info info = dockerClient.info();
6565
System.out.print(info);
66-
66+
6767
###### Search Docker repository:
6868

6969
List<SearchItem> dockerSearch = dockerClient.search("busybox");
7070
System.out.println("Search returned" + dockerSearch.toString());
71-
71+
7272
###### Create new Docker container, wait for its start and stop it:
7373

7474
ContainerConfig containerConfig = new ContainerConfig();
@@ -81,7 +81,7 @@ Run build with tests:
8181
dockerClient.waitContainer(container.id);
8282

8383
dockerClient.stopContainer(container.id);
84-
84+
8585

8686
##### Support for UNIX sockets:
8787

@@ -114,3 +114,36 @@ user dockerClient.build(baseDir), where baseDir is a path to folder containing D
114114

115115
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")
116116

117+
## Configuration
118+
119+
There are a couple of configuration items, all of which have sensible defaults:
120+
121+
* `url` The Docker URL, e.g. `http://localhost:4243`.
122+
* `version` The API version, e.g. `1.11`.
123+
* `username` Your repository username (required to push containers).
124+
* `password` Your repository password.
125+
* `email` Your repository email.
126+
127+
There are three ways to configure, in descending order of precedence:
128+
129+
##### Programatic:
130+
In your application, e.g.
131+
132+
DockerClient docker = new DockerClient("http://localhost:4243");
133+
docker.setCredentials("dockeruser", "ilovedocker", "dockeruser@github.com");`
134+
135+
##### System Properties:
136+
E.g.
137+
138+
java -Ddocker.io.username=kpelykh pkg.Main
139+
140+
##### File System
141+
In `$HOME/.docker.io.properties`, e.g.:
142+
143+
docker.io.username=dockeruser
144+
145+
##### Class Path
146+
In the class path at `/docker.io.properties`, e.g.:
147+
148+
docker.io.url=http://localhost:4243
149+
docker.io.version=1.11

src/main/java/com/kpelykh/docker/client/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static Config createConfig() throws DockerException {
1717
final Properties p = new Properties();
1818

1919
try {
20-
p.load(DockerClient.class.getResourceAsStream("/docker.io.properties"));
20+
p.load(Config.class.getResourceAsStream("/docker.io.properties"));
2121
} catch (IOException e) {
2222
throw new DockerException(e);
2323
}

0 commit comments

Comments
 (0)