METADATA 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. Metadata-Version: 2.3
  2. Name: docker
  3. Version: 7.1.0
  4. Summary: A Python library for the Docker Engine API.
  5. Project-URL: Changelog, https://docker-py.readthedocs.io/en/stable/change-log.html
  6. Project-URL: Documentation, https://docker-py.readthedocs.io
  7. Project-URL: Homepage, https://github.com/docker/docker-py
  8. Project-URL: Source, https://github.com/docker/docker-py
  9. Project-URL: Tracker, https://github.com/docker/docker-py/issues
  10. Maintainer-email: "Docker Inc." <no-reply@docker.com>
  11. License-Expression: Apache-2.0
  12. License-File: LICENSE
  13. Classifier: Development Status :: 5 - Production/Stable
  14. Classifier: Environment :: Other Environment
  15. Classifier: Intended Audience :: Developers
  16. Classifier: License :: OSI Approved :: Apache Software License
  17. Classifier: Operating System :: OS Independent
  18. Classifier: Programming Language :: Python
  19. Classifier: Programming Language :: Python :: 3
  20. Classifier: Programming Language :: Python :: 3.8
  21. Classifier: Programming Language :: Python :: 3.9
  22. Classifier: Programming Language :: Python :: 3.10
  23. Classifier: Programming Language :: Python :: 3.11
  24. Classifier: Programming Language :: Python :: 3.12
  25. Classifier: Topic :: Software Development
  26. Classifier: Topic :: Utilities
  27. Requires-Python: >=3.8
  28. Requires-Dist: pywin32>=304; sys_platform == 'win32'
  29. Requires-Dist: requests>=2.26.0
  30. Requires-Dist: urllib3>=1.26.0
  31. Provides-Extra: dev
  32. Requires-Dist: coverage==7.2.7; extra == 'dev'
  33. Requires-Dist: pytest-cov==4.1.0; extra == 'dev'
  34. Requires-Dist: pytest-timeout==2.1.0; extra == 'dev'
  35. Requires-Dist: pytest==7.4.2; extra == 'dev'
  36. Requires-Dist: ruff==0.1.8; extra == 'dev'
  37. Provides-Extra: docs
  38. Requires-Dist: myst-parser==0.18.0; extra == 'docs'
  39. Requires-Dist: sphinx==5.1.1; extra == 'docs'
  40. Provides-Extra: ssh
  41. Requires-Dist: paramiko>=2.4.3; extra == 'ssh'
  42. Provides-Extra: tls
  43. Provides-Extra: websockets
  44. Requires-Dist: websocket-client>=1.3.0; extra == 'websockets'
  45. Description-Content-Type: text/markdown
  46. # Docker SDK for Python
  47. [![Build Status](https://github.com/docker/docker-py/actions/workflows/ci.yml/badge.svg)](https://github.com/docker/docker-py/actions/workflows/ci.yml)
  48. 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.
  49. ## Installation
  50. The latest stable version [is available on PyPI](https://pypi.python.org/pypi/docker/). Install with pip:
  51. pip install docker
  52. > Older versions (< 6.0) required installing `docker[tls]` for SSL/TLS support.
  53. > This is no longer necessary and is a no-op, but is supported for backwards compatibility.
  54. ## Usage
  55. Connect to Docker using the default socket or the configuration in your environment:
  56. ```python
  57. import docker
  58. client = docker.from_env()
  59. ```
  60. You can run containers:
  61. ```python
  62. >>> client.containers.run("ubuntu:latest", "echo hello world")
  63. 'hello world\n'
  64. ```
  65. You can run containers in the background:
  66. ```python
  67. >>> client.containers.run("bfirsh/reticulate-splines", detach=True)
  68. <Container '45e6d2de7c54'>
  69. ```
  70. You can manage containers:
  71. ```python
  72. >>> client.containers.list()
  73. [<Container '45e6d2de7c54'>, <Container 'db18e4f20eaa'>, ...]
  74. >>> container = client.containers.get('45e6d2de7c54')
  75. >>> container.attrs['Config']['Image']
  76. "bfirsh/reticulate-splines"
  77. >>> container.logs()
  78. "Reticulating spline 1...\n"
  79. >>> container.stop()
  80. ```
  81. You can stream logs:
  82. ```python
  83. >>> for line in container.logs(stream=True):
  84. ... print(line.strip())
  85. Reticulating spline 2...
  86. Reticulating spline 3...
  87. ...
  88. ```
  89. You can manage images:
  90. ```python
  91. >>> client.images.pull('nginx')
  92. <Image 'nginx'>
  93. >>> client.images.list()
  94. [<Image 'ubuntu'>, <Image 'nginx'>, ...]
  95. ```
  96. [Read the full documentation](https://docker-py.readthedocs.io) to see everything you can do.