Kaydet (Commit) 199023c5 authored tarafından micahhausler's avatar micahhausler

Added markdown docs

üst b93fca63
......@@ -8,3 +8,6 @@ dist
.tox
.coverage
html/*
# Compiled Documentation
site/
This diff is collapsed.
This diff is collapsed.
# Contributing
See the [Docker contributing guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md).
The following is specific to docker-py.
## Running the tests & Code Quality
To get the source source code and run the unit tests, run:
```
$ git clone git://github.com/docker/docker-py.git
$ cd docker-py
$ pip install tox
$ tox
```
## Building the docs
Docs are built with [MkDocs](http://www.mkdocs.org/). For development, you can
run the following in the project directory:
```
$ pip install -r docs-requirements.txt
$ mkdocs serve
```
## Release Checklist
Before a new release, please go through the following checklist:
* Bump version in docker/version.py
* Add a release note in docs/release_notes.md
* Git tag the version
* Upload to pypi
## Vulnerability Reporting
For any security issues, please do NOT file an issue or pull request on github!
Please contact [security@docker.com](mailto:security@docker.com) or read [the
Docker security page](https://www.docker.com/resources/security/).
# docker-py documentation
An API client for docker written in Python
## Installation
Our latest stable is always available on PyPi.
pip install docker-py
## Documentation
Full documentation is available in the `/docs/` directory.
## License
Docker is licensed under the Apache License, Version 2.0. See LICENSE for full
license text
# Port bindings
Port bindings is done in two parts. Firstly, by providing a list of ports to
open inside the container in the `Client().create_container()` method.
```python
c.create_container('busybox', 'ls', ports=[1111, 2222])
```
Bindings are then declared in the `Client.start` method.
```python
c.start(container_id, port_bindings={1111: 4567, 2222: None})
```
You can limit the host address on which the port will be exposed like such:
```python
c.start(container_id, port_bindings={1111: ('127.0.0.1', 4567)})
```
Or without host port assignment:
```python
c.start(container_id, port_bindings={1111: ('127.0.0.1',)})
```
If you wish to use UDP instead of TCP (default), you need to declare it
like such in both the `create_container()` and `start()` calls:
```python
container_id = c.create_container(
'busybox',
'ls',
ports=[(1111, 'udp'), 2222]
)
c.start(container_id, port_bindings={'1111/udp': 4567, 2222: None})
```
# Release Notes
## v0.5.4
* This is the initial release of docker-py with MkDocs documentation.
## Connection to daemon using HTTPS
**Note:** *These instructions are docker-py specific. Please refer to
[http://docs.docker.com/articles/https/](http://docs.docker.com/articles/https/)
first.*
## TLSConfig
**Params**:
* client_cert (tuple of str): Path to client cert, path to client key
* ca_cert (str): Path to CA cert file
* verify (bool or str): This can be `False` or a path to a CA Cert file
* ssl_version (int): A valid [SSL version](
https://docs.python.org/3.4/library/ssl.html#ssl.PROTOCOL_TLSv1)
* assert_hostname (bool): Verify hostname of docker daemon
### configure_client
**Params**:
* client: ([Client](api.md#client-api)): A client to apply this config to
## Authenticate server based on public/default CA pool
```python
client = docker.Client(base_url='<https_url>', tls=True)
```
Equivalent CLI options:
```bash
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(ca_cert='/path/to/ca.pem')
client = docker.Client(base_url='<https_url>', tls=tls_config)
```
Equivalent CLI options:
```bash
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(
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:
```bash
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(
client_cert=('/path/to/client-cert.pem', '/path/to/client-key.pem'),
ca_cert='/path/to/ca.pem'
)
client = docker.Client(base_url='<https_url>', tls=tls_config)
```
Equivalent CLI options:
```bash
docker --tlsverify \
--tlscert /path/to/client-cert.pem \
--tlskey /path/to/client-key.pem \
--tlscacert /path/to/ca.pem ...
```
# Using volumes
Volume declaration is done in two parts. First, you have to provide a list of
mountpoints to the `Client().create_container()` method.
```python
c.create_container('busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2'])
```
Volume mappings are then declared inside the `Client.start` method like this:
```python
c.start(container_id, binds={
'/home/user1/':
{
'bind': '/mnt/vol2',
'ro': False
},
'/var/www':
{
'bind': '/mnt/vol1',
'ro': True
}
})
```
site_name: docker-py Documentation
site_description: An API client for docker written in Python
site_favicon: favicon_whale.png
# site_url: docker-py.readthedocs.org
repo_url: https://github.com/docker/docker-py/
theme: readthedocs
pages:
- [index.md, Home]
- [api.md, Client API]
- [port-bindings.md, Port Bindings]
- [volumes.md, Using Volumes]
- [tls.md, Using TLS]
- [release_notes.md, Release Notes]
- [contributing.md, Contributing]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment