mirror of https://github.com/docker/docker-py.git
Signed-off-by: Corentin Henry <corentinhenry@gmail.com>
pytest-timeout 1.2.1 seems to be incompatible with pytest 3.6.3:
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/_pytest/main.py", line 185, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/_pytest/main.py", line 225, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/hooks.py", line 284, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 67, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 61, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
INTERNALERROR> _reraise(*ex) # noqa
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/_pytest/main.py", line 246, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/hooks.py", line 284, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 67, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/manager.py", line 61, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
INTERNALERROR> _reraise(*ex) # noqa
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pluggy/callers.py", line 182, in _multicall
INTERNALERROR> next(gen) # first yield
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pytest_timeout.py", line 76, in pytest_runtest_protocol
INTERNALERROR> timeout_setup(item)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pytest_timeout.py", line 104, in timeout_setup
INTERNALERROR> timeout, method = get_params(item)
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pytest_timeout.py", line 162, in get_params
INTERNALERROR> timeout, method = _parse_marker(item.keywords['timeout'])
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/pytest_timeout.py", line 178, in _parse_marker
INTERNALERROR> if not marker.args and not marker.kwargs:
INTERNALERROR> File "/usr/local/lib/python2.7/site-packages/_pytest/mark/structures.py", line 25, in warned
INTERNALERROR> warnings.warn(warning, stacklevel=2)
INTERNALERROR> RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly.
INTERNALERROR> Please use node.get_closest_marker(name) or node.iter_markers(name).
INTERNALERROR> Docs: https://docs.pytest.org/en/latest/mark.html#updating-code
|
||
|---|---|---|
| docker | ||
| docs | ||
| scripts | ||
| tests | ||
| .coveragerc | ||
| .dockerignore | ||
| .editorconfig | ||
| .gitignore | ||
| .travis.yml | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| Dockerfile-docs | ||
| Dockerfile-py3 | ||
| Jenkinsfile | ||
| LICENSE | ||
| MAINTAINERS | ||
| MANIFEST.in | ||
| Makefile | ||
| README.md | ||
| appveyor.yml | ||
| docs-requirements.txt | ||
| pytest.ini | ||
| requirements.txt | ||
| setup.cfg | ||
| setup.py | ||
| test-requirements.txt | ||
| tox.ini | ||
| win32-requirements.txt | ||
README.md
Docker SDK for Python
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.
Installation
The latest stable version is available on PyPI. Either add docker to your requirements.txt file or install with pip:
pip install docker
If you are intending to connect to a docker host via TLS, add docker[tls] to your requirements instead, or install with pip:
pip install docker[tls]
Usage
Connect to Docker using the default socket or the configuration in your environment:
import docker
client = docker.from_env()
You can run containers:
>>> client.containers.run("ubuntu:latest", "echo hello world")
'hello world\n'
You can run containers in the background:
>>> client.containers.run("bfirsh/reticulate-splines", detach=True)
<Container '45e6d2de7c54'>
You can manage containers:
>>> client.containers.list()
[<Container '45e6d2de7c54'>, <Container 'db18e4f20eaa'>, ...]
>>> container = client.containers.get('45e6d2de7c54')
>>> container.attrs['Config']['Image']
"bfirsh/reticulate-splines"
>>> container.logs()
"Reticulating spline 1...\n"
>>> container.stop()
You can stream logs:
>>> for line in container.logs(stream=True):
... print line.strip()
Reticulating spline 2...
Reticulating spline 3...
...
You can manage images:
>>> client.images.pull('nginx')
<Image 'nginx'>
>>> client.images.list()
[<Image 'ubuntu'>, <Image 'nginx'>, ...]
Read the full documentation to see everything you can do.