Added TLS configuration instructions in README.md

This commit is contained in:
Joffrey F 2014-06-23 20:32:27 +02:00
parent 116d1370af
commit 72c29ee5cf
1 changed files with 41 additions and 0 deletions

View File

@ -342,3 +342,44 @@ c.start(container_id, binds={
}
})
```
Connection to daemon using HTTPS
================================
*These instructions are docker-py specific. Please refer to
http://docs.docker.com/articles/https/ first.*
* Authenticate server based on public/default CA pool
```python
client = docker.Client(base_url='<https_url>', tls=True)
```
* Authenticate server based on given CA
```python
tls_config = docker.tls.TLSConfig(
False, tls_verify=True, tls_ca_cert='/path/to/ca.pem')
client = docker.Client(base_url='<https_url>', tls=tls_config)
```
* Authenticate with client certificate, do not authenticate server
based on given CA
```python
tls_config = docker.tls.TLSConfig(
True, tls_cert='/path/to/client-cert.pem',
tls_key='/path/to/client-key.pem'
)
client = docker.Client(base_url='<https_url>', tls=tls_config)
```
* Authenticate with client certificate, authenticate server based on given CA
```python
tls_config = docker.tls.TLSConfig(
False, tls_cert='/path/to/client-cert.pem',
tls_key='/path/to/client-key.pem', tls_ca_cert='/path/to/ca.pem'
)
client = docker.Client(base_url='<https_url>', tls=tls_config)
```