Skip to content

Commit 1f93cad

Browse files
authored
Update README.md
1 parent 77a3abd commit 1f93cad

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ The library comes as a maven dependency:
3434

3535
If you are not using Maven, you can also download the <a href="https://oss.sonatype.org/service/local/repositories/releases/content/com/amihaiemil/web/docker-java-api/0.0.12/docker-java-api-0.0.12-jar-with-dependencies.jar">fat</a> jar.
3636

37+
### Usage
38+
39+
Here is all you need to do in order to pull an Image and run a Container from/into the local Docker engine:
40+
41+
```java
42+
final Container started = new UnixDocker(new File("/var/run/docker.sock"))
43+
.images()
44+
.pull("hello-world", "latest")
45+
.container();
46+
```
47+
or, the same code snippet, less fluent:
48+
```java
49+
final Docker docker = new UnixDocker(new File("/var/run/docker.sock"));
50+
final Images images = docker.images();
51+
for(final Image image : images){
52+
//iterate over the existing images
53+
}
54+
final Image helloWorld = images.pull("hello-world", "latest");
55+
final Container started = helloWorld.container();
56+
```
57+
3758
### Contributing
3859

3960
If you would like to contribute, just open an issue or a PR.

0 commit comments

Comments
 (0)