Python lib库docker-py和docker的区别

1)两者的安装方式

pip install docker

A Python library for the Docker Engine API
pip install docker-py
A Python library for the Docker Remote API.

2)两者的区别
In this repository, we use docker-py (in requirements.txt, or in Dockerfile-alpine).
This is older package, last version 1.10.6 on pypi is from 2016-11-02.
The newer package is called docker (newest ver. 2.2.1 from 2017-03-28).
Besides the ambiguous name, docker package is incompatible with docker-py.
在这个存储库中,我们使用docker-py(在requirements.txt中,或在Dockerfile-alpine中)。
这是较旧的软件包,pypi的最新版本1.10.6是2016-11-02。
较新的包称为docker(2017-03-28最新版本2.2.1)。
除了模糊的名称,docker包与docker-py不兼容。

the breaking changes (and new features) from version 1.10.6 (docker-py) to 2.0.0 (docker) can be found at docker-py documentation.
The relevant changes, I think, are:
从版本1.10.6(docker-py)到2.0.0(docker)的重大更改(和新功能)可以在docker-py文档中找到。
我认为相关的变化是:
docker.Client has been renamed to docker.APIClient
docker.from_env now creates a DockerClient instance instead of an APIClient instance
create_host_config, create_ipam_pool and create_ipam_config have been removed from docker.utils.
They have been replaced by the following classes in docker.types: HostConfig, IPAMPool and IPAMCOnfig.
(new feature) Added a high-level, user-focused API as docker.DockerClient
docker.Client已重命名为docker.APIClient
docker.from_env现在创建一个DockerClient实例而不是APIClient实例
已从docker.utils中删除create_host_config,create_ipam_pool和create_ipam_config。
它们已被docker.types中的以下类替换:HostConfig,IPAMPool和IPAMCOnfig。
(新功能)添加了一个高级的,以用户为中心的API作为docker.DockerClient

原文地址:https://www.cnblogs.com/potato-chip/p/10036869.html