Name | docker JSON |
Version |
7.1.0
JSON |
| download |
home_page | None |
Summary | A Python library for the Docker Engine API. |
upload_time | 2024-05-23 11:13:57 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# Docker SDK for Python
[![Build Status](https://github.com/docker/docker-py/actions/workflows/ci.yml/badge.svg)](https://github.com/docker/docker-py/actions/workflows/ci.yml)
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](https://pypi.python.org/pypi/docker/). Install with pip:
pip install docker
> Older versions (< 6.0) required installing `docker[tls]` for SSL/TLS support.
> This is no longer necessary and is a no-op, but is supported for backwards compatibility.
## Usage
Connect to Docker using the default socket or the configuration in your environment:
```python
import docker
client = docker.from_env()
```
You can run containers:
```python
>>> client.containers.run("ubuntu:latest", "echo hello world")
'hello world\n'
```
You can run containers in the background:
```python
>>> client.containers.run("bfirsh/reticulate-splines", detach=True)
<Container '45e6d2de7c54'>
```
You can manage containers:
```python
>>> 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:
```python
>>> for line in container.logs(stream=True):
... print(line.strip())
Reticulating spline 2...
Reticulating spline 3...
...
```
You can manage images:
```python
>>> client.images.pull('nginx')
<Image 'nginx'>
>>> client.images.list()
[<Image 'ubuntu'>, <Image 'nginx'>, ...]
```
[Read the full documentation](https://docker-py.readthedocs.io) to see everything you can do.
Raw data
{
"_id": null,
"home_page": null,
"name": "docker",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "\"Docker Inc.\" <no-reply@docker.com>",
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/91/9b/4a2ea29aeba62471211598dac5d96825bb49348fa07e906ea930394a83ce/docker-7.1.0.tar.gz",
"platform": null,
"description": "# Docker SDK for Python\n\n[![Build Status](https://github.com/docker/docker-py/actions/workflows/ci.yml/badge.svg)](https://github.com/docker/docker-py/actions/workflows/ci.yml)\n\nA Python library for the Docker Engine API. It lets you do anything the `docker` command does, but from within Python apps \u2013 run containers, manage containers, manage Swarms, etc.\n\n## Installation\n\nThe latest stable version [is available on PyPI](https://pypi.python.org/pypi/docker/). Install with pip:\n\n pip install docker\n\n> Older versions (< 6.0) required installing `docker[tls]` for SSL/TLS support.\n> This is no longer necessary and is a no-op, but is supported for backwards compatibility.\n\n## Usage\n\nConnect to Docker using the default socket or the configuration in your environment:\n\n```python\nimport docker\nclient = docker.from_env()\n```\n\nYou can run containers:\n\n```python\n>>> client.containers.run(\"ubuntu:latest\", \"echo hello world\")\n'hello world\\n'\n```\n\nYou can run containers in the background:\n\n```python\n>>> client.containers.run(\"bfirsh/reticulate-splines\", detach=True)\n<Container '45e6d2de7c54'>\n```\n\nYou can manage containers:\n\n```python\n>>> client.containers.list()\n[<Container '45e6d2de7c54'>, <Container 'db18e4f20eaa'>, ...]\n\n>>> container = client.containers.get('45e6d2de7c54')\n\n>>> container.attrs['Config']['Image']\n\"bfirsh/reticulate-splines\"\n\n>>> container.logs()\n\"Reticulating spline 1...\\n\"\n\n>>> container.stop()\n```\n\nYou can stream logs:\n\n```python\n>>> for line in container.logs(stream=True):\n... print(line.strip())\nReticulating spline 2...\nReticulating spline 3...\n...\n```\n\nYou can manage images:\n\n```python\n>>> client.images.pull('nginx')\n<Image 'nginx'>\n\n>>> client.images.list()\n[<Image 'ubuntu'>, <Image 'nginx'>, ...]\n```\n\n[Read the full documentation](https://docker-py.readthedocs.io) to see everything you can do.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library for the Docker Engine API.",
"version": "7.1.0",
"project_urls": {
"Changelog": "https://docker-py.readthedocs.io/en/stable/change-log.html",
"Documentation": "https://docker-py.readthedocs.io",
"Homepage": "https://github.com/docker/docker-py",
"Source": "https://github.com/docker/docker-py",
"Tracker": "https://github.com/docker/docker-py/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e32657c6fb270950d476074c087527a558ccb6f4436657314bfb6cdf484114c4",
"md5": "f3c0c7aafc62932ceaab8e697f3ac4f1",
"sha256": "c96b93b7f0a746f9e77d325bcfb87422a3d8bd4f03136ae8a85b37f1898d5fc0"
},
"downloads": -1,
"filename": "docker-7.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f3c0c7aafc62932ceaab8e697f3ac4f1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 147774,
"upload_time": "2024-05-23T11:13:55",
"upload_time_iso_8601": "2024-05-23T11:13:55.010193Z",
"url": "https://files.pythonhosted.org/packages/e3/26/57c6fb270950d476074c087527a558ccb6f4436657314bfb6cdf484114c4/docker-7.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "919b4a2ea29aeba62471211598dac5d96825bb49348fa07e906ea930394a83ce",
"md5": "04e92a7b6dc8b88dde3c7cca6850b277",
"sha256": "ad8c70e6e3f8926cb8a92619b832b4ea5299e2831c14284663184e200546fa6c"
},
"downloads": -1,
"filename": "docker-7.1.0.tar.gz",
"has_sig": false,
"md5_digest": "04e92a7b6dc8b88dde3c7cca6850b277",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 117834,
"upload_time": "2024-05-23T11:13:57",
"upload_time_iso_8601": "2024-05-23T11:13:57.216503Z",
"url": "https://files.pythonhosted.org/packages/91/9b/4a2ea29aeba62471211598dac5d96825bb49348fa07e906ea930394a83ce/docker-7.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-23 11:13:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "docker",
"github_project": "docker-py",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "docker"
}