Skip to content

Commit 3bc06bb

Browse files
authored
Merge pull request #1343 from docker/2.0.0-release
2.0.0 release
2 parents 997e583 + b45f265 commit 3bc06bb

File tree

136 files changed

+9587
-4304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+9587
-4304
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dist
1010
html/*
1111

1212
# Compiled Documentation
13-
site/
13+
_build/
1414
README.rst
1515

1616
env/

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: python
33
python:
44
- "3.5"
55
env:
6-
- TOX_ENV=py26
76
- TOX_ENV=py27
87
- TOX_ENV=py33
98
- TOX_ENV=py34

CONTRIBUTING.md

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# Contributing guidelines
22

3+
See the [Docker contributing guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md).
4+
The following is specific to Docker SDK for Python.
5+
36
Thank you for your interest in the project. We look forward to your
47
contribution. In order to make the process as fast and streamlined as possible,
58
here is a set of guidelines we recommend you follow.
69

710
## Reporting issues
811

912
We do our best to ensure bugs don't creep up in our releases, but some may
10-
still slip through. If you encounter one while using docker-py, please create
11-
an issue [in the tracker](https://github.com/docker/docker-py/issues/new) with
13+
still slip through. If you encounter one while using the SDK, please
14+
create an issue
15+
[in the tracker](https://github.com/docker/docker-py/issues/new) with
1216
the following information:
1317

14-
- docker-py version, docker version and python version
18+
- SDK version, Docker version and python version
1519
```
16-
pip freeze | grep docker-py && python --version && docker version
20+
pip freeze | grep docker && python --version && docker version
1721
```
1822
- OS, distribution and OS version
1923
- The issue you're encountering including a stacktrace if applicable
2024
- If possible, steps or a code snippet to reproduce the issue
2125

2226
To save yourself time, please be sure to check our
2327
[documentation](https://docker-py.readthedocs.io/) and use the
24-
[search function](https://github.com/docker/docker-py/search) to find out if
25-
it has already been addressed, or is currently being looked at.
28+
[search function](https://github.com/docker/docker-py/search) to find
29+
out if it has already been addressed, or is currently being looked at.
2630

2731
## Submitting pull requests
2832

2933
Do you have a fix for an existing issue, or want to add a new functionality
30-
to docker-py? We happily welcome pull requests. Here are a few tips to make
31-
the review process easier on both the maintainers and yourself.
34+
to the SDK? We happily welcome pull requests. Here are a few tips to
35+
make the review process easier on both the maintainers and yourself.
3236

3337
### 1. Sign your commits
3438

@@ -84,11 +88,10 @@ to reach out and ask questions. We will do our best to answer and help out.
8488

8589
## Development environment
8690

87-
If you're looking contribute to docker-py but are new to the project or Python,
88-
here are the steps to get you started.
91+
If you're looking contribute to Docker SDK for Python but are new to the
92+
project or Python, here are the steps to get you started.
8993

90-
1. Fork [https://github.com/docker/docker-py](https://github.com/docker/docker-py)
91-
to your username.
94+
1. Fork https://github.com/docker/docker-py to your username.
9295
2. Clone your forked repository locally with
9396
`git clone [email protected]:yourusername/docker-py.git`.
9497
3. Configure a
@@ -100,3 +103,33 @@ here are the steps to get you started.
100103
5. Run `python setup.py develop` to install the dev version of the project
101104
and required dependencies. We recommend you do so inside a
102105
[virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs)
106+
107+
## Running the tests & Code Quality
108+
109+
To get the source source code and run the unit tests, run:
110+
```
111+
$ git clone git://github.com/docker/docker-py.git
112+
$ cd docker-py
113+
$ make test
114+
```
115+
116+
## Building the docs
117+
118+
```
119+
$ make docs
120+
$ open _build/index.html
121+
```
122+
123+
## Release Checklist
124+
125+
Before a new release, please go through the following checklist:
126+
127+
* Bump version in docker/version.py
128+
* Add a release note in docs/change_log.md
129+
* Git tag the version
130+
* Upload to pypi
131+
132+
## Vulnerability Reporting
133+
For any security issues, please do NOT file an issue or pull request on github!
134+
Please contact [[email protected]](mailto:[email protected]) or read [the
135+
Docker security page](https://www.docker.com/resources/security/).

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
FROM python:2.7
2-
MAINTAINER Joffrey F <[email protected]>
32

4-
RUN mkdir /home/docker-py
5-
WORKDIR /home/docker-py
3+
RUN mkdir /src
4+
WORKDIR /src
65

7-
COPY requirements.txt /home/docker-py/requirements.txt
6+
COPY requirements.txt /src/requirements.txt
87
RUN pip install -r requirements.txt
98

10-
COPY test-requirements.txt /home/docker-py/test-requirements.txt
9+
COPY test-requirements.txt /src/test-requirements.txt
1110
RUN pip install -r test-requirements.txt
1211

13-
COPY . /home/docker-py
12+
COPY . /src
1413
RUN pip install .

Dockerfile-docs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
FROM python:2.7
1+
FROM python:3.5
22

3-
RUN mkdir /home/docker-py
4-
WORKDIR /home/docker-py
3+
RUN mkdir /src
4+
WORKDIR /src
55

6-
COPY docs-requirements.txt /home/docker-py/docs-requirements.txt
6+
COPY requirements.txt /src/requirements.txt
7+
RUN pip install -r requirements.txt
8+
9+
COPY docs-requirements.txt /src/docs-requirements.txt
710
RUN pip install -r docs-requirements.txt
811

9-
COPY . /home/docker-py
12+
COPY . /src

Dockerfile-py3

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
FROM python:3.5
2-
MAINTAINER Joffrey F <[email protected]>
32

4-
RUN mkdir /home/docker-py
5-
WORKDIR /home/docker-py
3+
RUN mkdir /src
4+
WORKDIR /src
65

7-
COPY requirements.txt /home/docker-py/requirements.txt
6+
COPY requirements.txt /src/requirements.txt
87
RUN pip install -r requirements.txt
98

10-
COPY test-requirements.txt /home/docker-py/test-requirements.txt
9+
COPY test-requirements.txt /src/test-requirements.txt
1110
RUN pip install -r test-requirements.txt
1211

13-
COPY . /home/docker-py
12+
COPY . /src
1413
RUN pip install .

MAINTAINERS

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Docker-py maintainers file
1+
# Docker SDK for Python maintainers file
22
#
33
# This file describes who runs the docker/docker-py project and how.
44
# This is a living document - if you see something out of date or missing, speak up!
@@ -12,6 +12,7 @@
1212
[Org."Core maintainers"]
1313
people = [
1414
"aanand",
15+
"bfirsh",
1516
"dnephin",
1617
"mnowster",
1718
"mpetazzoni",
@@ -31,6 +32,11 @@
3132
3233
GitHub = "aanand"
3334

35+
[people.bfirsh]
36+
Name = "Ben Firshman"
37+
38+
GitHub = "bfirsh"
39+
3440
[people.dnephin]
3541
Name = "Daniel Nephin"
3642

Makefile

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ clean:
88

99
.PHONY: build
1010
build:
11-
docker build -t docker-py .
11+
docker build -t docker-sdk-python .
1212

1313
.PHONY: build-py3
1414
build-py3:
15-
docker build -t docker-py3 -f Dockerfile-py3 .
15+
docker build -t docker-sdk-python3 -f Dockerfile-py3 .
1616

1717
.PHONY: build-docs
1818
build-docs:
19-
docker build -t docker-py-docs -f Dockerfile-docs .
19+
docker build -t docker-sdk-python-docs -f Dockerfile-docs .
2020

2121
.PHONY: build-dind-certs
2222
build-dind-certs:
@@ -27,28 +27,28 @@ test: flake8 unit-test unit-test-py3 integration-dind integration-dind-ssl
2727

2828
.PHONY: unit-test
2929
unit-test: build
30-
docker run docker-py py.test tests/unit
30+
docker run --rm docker-sdk-python py.test tests/unit
3131

3232
.PHONY: unit-test-py3
3333
unit-test-py3: build-py3
34-
docker run docker-py3 py.test tests/unit
34+
docker run --rm docker-sdk-python3 py.test tests/unit
3535

3636
.PHONY: integration-test
3737
integration-test: build
38-
docker run -v /var/run/docker.sock:/var/run/docker.sock docker-py py.test tests/integration
38+
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python py.test tests/integration/${file}
3939

4040
.PHONY: integration-test-py3
4141
integration-test-py3: build-py3
42-
docker run -v /var/run/docker.sock:/var/run/docker.sock docker-py3 py.test tests/integration
42+
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python3 py.test tests/integration/${file}
4343

4444
.PHONY: integration-dind
4545
integration-dind: build build-py3
4646
docker rm -vf dpy-dind || :
47-
docker run -d --name dpy-dind --privileged dockerswarm/dind:1.12.0 docker daemon\
47+
docker run -d --name dpy-dind --privileged dockerswarm/dind:1.13.0-rc3 docker daemon\
4848
-H tcp://0.0.0.0:2375
49-
docker run --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py\
49+
docker run --rm --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-sdk-python\
5050
py.test tests/integration
51-
docker run --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py3\
51+
docker run --rm --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-sdk-python3\
5252
py.test tests/integration
5353
docker rm -vf dpy-dind
5454

@@ -57,21 +57,25 @@ integration-dind-ssl: build-dind-certs build build-py3
5757
docker run -d --name dpy-dind-certs dpy-dind-certs
5858
docker run -d --env="DOCKER_HOST=tcp://localhost:2375" --env="DOCKER_TLS_VERIFY=1"\
5959
--env="DOCKER_CERT_PATH=/certs" --volumes-from dpy-dind-certs --name dpy-dind-ssl\
60-
-v /tmp --privileged dockerswarm/dind:1.12.0 docker daemon --tlsverify\
60+
-v /tmp --privileged dockerswarm/dind:1.13.0-rc3 docker daemon --tlsverify\
6161
--tlscacert=/certs/ca.pem --tlscert=/certs/server-cert.pem\
6262
--tlskey=/certs/server-key.pem -H tcp://0.0.0.0:2375
63-
docker run --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
63+
docker run --rm --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
6464
--env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs"\
65-
--link=dpy-dind-ssl:docker docker-py py.test tests/integration
66-
docker run --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
65+
--link=dpy-dind-ssl:docker docker-sdk-python py.test tests/integration
66+
docker run --rm --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
6767
--env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs"\
68-
--link=dpy-dind-ssl:docker docker-py3 py.test tests/integration
68+
--link=dpy-dind-ssl:docker docker-sdk-python3 py.test tests/integration
6969
docker rm -vf dpy-dind-ssl dpy-dind-certs
7070

7171
.PHONY: flake8
7272
flake8: build
73-
docker run docker-py flake8 docker tests
73+
docker run --rm docker-sdk-python flake8 docker tests
7474

7575
.PHONY: docs
7676
docs: build-docs
77-
docker run -v `pwd`/docs:/home/docker-py/docs/ -p 8000:8000 docker-py-docs mkdocs serve -a 0.0.0.0:8000
77+
docker run --rm -it -v `pwd`:/code docker-sdk-python-docs sphinx-build docs ./_build
78+
79+
.PHONY: shell
80+
shell: build
81+
docker run -it -v /var/run/docker.sock:/var/run/docker.sock docker-sdk-python python

README.md

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,77 @@
1-
docker-py
2-
=========
1+
# Docker SDK for Python
32

4-
[![Build Status](https://travis-ci.org/docker/docker-py.png)](https://travis-ci.org/docker/docker-py)
3+
[![Build Status](https://travis-ci.org/docker/docker-py.svg?branch=master)](https://travis-ci.org/docker/docker-py)
54

6-
A Python library for the Docker Remote API. It does everything the `docker` command does, but from within Python – run containers, manage them, pull/push images, etc.
5+
**Warning:** This README is for the development version of the Docker SDK for
6+
Python, which is significantly different to the stable version.
7+
[Documentation for the stable version is here.](https://docker-py.readthedocs.io/)
78

8-
Installation
9-
------------
9+
A Python library for the Docker Engine API. It lets you do anything the `docker` command does, but from within Python apps – run containers, manage containers, manage Swarms, etc.
1010

11-
The latest stable version is always available on PyPi.
11+
## Installation
1212

13-
pip install docker-py
13+
The latest stable version [is available on PyPi](https://pypi.python.org/pypi/docker/). Either add `docker` to your `requirements.txt` file or install with pip:
1414

15-
Documentation
16-
-------------
15+
pip install docker
1716

18-
[![Documentation Status](https://readthedocs.org/projects/docker-py/badge/?version=latest)](https://readthedocs.org/projects/docker-py/?badge=latest)
17+
## Usage
1918

20-
[Read the full documentation here](https://docker-py.readthedocs.io/en/latest/).
21-
The source is available in the `docs/` directory.
19+
Connect to Docker using the default socket or the configuration in your environment:
2220

21+
```python
22+
import docker
23+
client = docker.from_env()
24+
```
2325

24-
License
25-
-------
26-
Docker is licensed under the Apache License, Version 2.0. See LICENSE for full license text
26+
You can run containers:
27+
28+
```python
29+
>>> client.containers.run("ubuntu", "echo hello world")
30+
'hello world\n'
31+
```
32+
33+
You can run containers in the background:
34+
35+
```python
36+
>>> client.containers.run("bfirsh/reticulate-splines", detach=True)
37+
<Container '45e6d2de7c54'>
38+
```
39+
40+
You can manage containers:
41+
42+
```python
43+
>>> client.containers.list()
44+
[<Container '45e6d2de7c54'>, <Container 'db18e4f20eaa'>, ...]
45+
46+
>>> container = client.containers.get('45e6d2de7c54')
47+
48+
>>> container.attrs['Config']['Image']
49+
"bfirsh/reticulate-splines"
50+
51+
>>> container.logs()
52+
"Reticulating spline 1...\n"
53+
54+
>>> container.stop()
55+
```
56+
57+
You can stream logs:
58+
59+
```python
60+
>>> for line in container.logs(stream=True):
61+
... print line.strip()
62+
Reticulating spline 2...
63+
Reticulating spline 3...
64+
...
65+
```
66+
67+
You can manage images:
68+
69+
```python
70+
>>> client.images.pull('nginx')
71+
<Image 'nginx'>
72+
73+
>>> client.images.list()
74+
[<Image 'ubuntu'>, <Image 'nginx'>, ...]
75+
```
76+
77+
[Read the full documentation](https://docker-py.readthedocs.io) to see everything you can do.

docker/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
# flake8: noqa
2+
from .api import APIClient
3+
from .client import DockerClient, from_env
14
from .version import version, version_info
25

36
__version__ = version
4-
__title__ = 'docker-py'
5-
6-
from .client import Client, AutoVersionClient, from_env # flake8: noqa
7+
__title__ = 'docker'

0 commit comments

Comments
 (0)