diff options
author | Joffrey F <joffrey@docker.com> | 2014-07-08 14:56:48 +0200 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2014-07-08 14:56:48 +0200 |
commit | 8393dbcaff88576cf6a36be598e11d6b95d6f3dc (patch) | |
tree | a392a863caf1453f0c0507e0bb52390dc7453401 /README.md | |
parent | db454f01b81c1ae4c5a71ab30bb548d8f7599ded (diff) | |
download | docker-py-8393dbcaff88576cf6a36be598e11d6b95d6f3dc.tar.gz |
Improved TLSConfig API to be less obscure / more pythonic. Also improved / amended docs
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -355,31 +355,49 @@ http://docs.docker.com/articles/https/ first.* client = docker.Client(base_url='<https_url>', tls=True) ``` +Equivalent CLI options: `docker --tls ...` + +If you want to use TLS but don't want to verify the server certificate +(for example when testing with a self-signed certificate): + +```python +tls_config = docker.tls.TLSConfig(verify=False) +client = docker.Client(base_url='<https_url>', tls=tls_config) +``` + * Authenticate server based on given CA ```python -tls_config = docker.tls.TLSConfig( - False, tls_verify=True, tls_ca_cert='/path/to/ca.pem') +tls_config = docker.tls.TLSConfig(server_cacert='/path/to/ca.pem') client = docker.Client(base_url='<https_url>', tls=tls_config) ``` +Equivalent CLI options: `docker --tlsverify --tlscacert /path/to/ca.pem ...` + * 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' + True, client_cert=('/path/to/client-cert.pem', '/path/to/client-key.pem') ) client = docker.Client(base_url='<https_url>', tls=tls_config) ``` +Equivalent CLI options: +`docker --tls --tlscert /path/to/client-cert.pem +--tlskey /path/to/client-key.pem ...` + * 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_cert=('/path/to/client-cert.pem', '/path/to/client-key.pem'), + server_cacert='/path/to/ca.pem' ) client = docker.Client(base_url='<https_url>', tls=tls_config) ``` + +Equivalent CLI options: +`docker --tlsverify --tlscert /path/to/client-cert.pem +--tlskey /path/to/client-key.pem --tlscacert /path/to/ca.pem ...`
\ No newline at end of file |