Skip to content

Commit dba55b1

Browse files
committed
document RegistryAuthSupplier in the user manual
forgot to do this in spotify#759 and spotify#762
1 parent 4697efd commit dba55b1

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 8.7.0 (not yet released)
3+
## 8.7.0 (released June 5, 2017)
44

55
### Expanded RegistryAuthSupplier support
66
Add RegistryAuthSuppliers for:

README.md

-10
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ final DockerClient docker = DefaultDockerClient.fromEnv().build();
4747
// Pull an image
4848
docker.pull("busybox");
4949

50-
// Pull an image from a private repository
51-
// Server address defaults to "https://index.docker.io/v1/"
52-
RegistryAuth registryAuth = RegistryAuth.builder().email("foo@bar.com").username("foobar")
53-
.password("secret-password").serverAddress("https://myprivateregistry.com/v1/").build();
54-
docker.pull("foobar/busybox-private:latest", registryAuth);
55-
56-
// You can also set the RegistryAuth for the DockerClient instead of passing everytime you call pull()
57-
DockerClient docker = DefaultDockerClient.fromEnv().registryAuth(registryAuth).build();
58-
5950
// Bind container ports to host ports
6051
final String[] ports = {"80", "22"};
6152
final Map<String, List<PortBinding>> portBindings = new HashMap<>();
@@ -111,7 +102,6 @@ docker.close();
111102
If you're looking for how to use docker-client, see the [User Manual][2].
112103
If you're looking for how to build and develop it, keep reading.
113104

114-
115105
## Prerequisites
116106

117107
docker-client should be buildable on any platform with Docker 1.6+, JDK7+, and a recent version of

docs/user_manual.md

+30
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This user manual is made to correspond to Docker's [API docs][1] (e.g. [API 1.18
66
* [Unix socket support](#unix-socket-support)
77
* [HTTPS support](#https-support)
88
* [Connection pooling](#connection-pooling)
9+
* [Authentication to private registries](#authentication-to-private-registries)
910
* [Containers](#containers)
1011
* [List containers](#list-containers)
1112
* [Create a container](#create-a-container)
@@ -114,6 +115,35 @@ Note that the connect timeout is also applied to acquiring a connection from the
114115
is exhausted and it takes too long to acquire a new connection for a request, we throw a
115116
`DockerTimeoutException` instead of just waiting forever on a connection becoming available.
116117

118+
## Authentication to private registries
119+
120+
Authentication info when building, pushing, or pulling images, or when using
121+
Swarm, is provided by a `RegistryAuthSupplier` class.
122+
123+
Docker-client is packaged with a few implementations of this interface
124+
125+
- `auth.ConfigFileRegistryAuthSupplier`, which reads authentication info from
126+
the the config files used by docker-cli (`~/.dockercfg` or
127+
`~/.docker/config.json`)
128+
- `auth.NoOpRegistryAuthSupplier` which uses a fixed instance of the
129+
`RegistryAuth` and `RegistryConfigs` POJOs
130+
- `auth.gcr.ContainerRegistryAuthSupplier`, which programmatically fetches
131+
access tokens for use with Google Container Registry based on given Gogole
132+
Cloud account credentials
133+
- `auth.MultiRegistryAuthSupplier`, which can be used to combine multiple other
134+
implementations
135+
136+
Users are encouraged to implement the `RegistryAuthSupplier` interface
137+
themselves to support custom authentication logic, and we would be happy to
138+
review and accept pull requests to add support in the library for additional
139+
schemes.
140+
141+
Since version 8.7.0, docker-client will automatically enable the
142+
`ConfigFileRegistryAuthSupplier` class in `DefaultDockerClient` as long as none
143+
of the other authentication-related methods in the
144+
`DefaultDockerClient.Builder` class (`dockerAuth(boolean)`,
145+
`registryAuth(RegistryAuth)`, or `registryAuthSupplier(RegistryAuthSupplier)`)
146+
are used.
117147

118148
## Containers
119149

0 commit comments

Comments
 (0)