帮助将项目部署到Portainer的包

portainer-p的Python项目详细描述


https://travis-ci.org/bob-codingdutchmen/portainer-py.svg?branch=master

安装

portainer py作为一个通用的 wheel和在linux/macos和windows上可用,并支持 python 3.5+。

$ pip install portainer-py

用法

从命令行

当前支持的唯一命令是deploy。 使用“帮助”功能了解如何使用它:

$ portainerpy deploy --help
Usage: portainerpy deploy [OPTIONS]

  Update and deploy a portainer stack.

  To ease automation, this utility also support using environment variables
  instead of using these command line options:

  --user       PORTAINER_USERNAME
  --password   PORTAINER_PASSWORD
  --host       PORTAINER_HOST
  --stackname  PORTAINER_STACK_NAME
  --stackfile  PORTAINER_STACKFILE

Options:
  -f, --stackfile PATH  Path to the stackfile.yml  [required]
  -h, --host TEXT       URL to Portainer host  [required]
  -u, --user TEXT       Portainer username  [required]
  -p, --password TEXT   Portainer password
  -n, --stackname TEXT  Name of the Portainer stack  [required]
  -e, --env TEXT        Environment variables to add to the stack
  --prune-env           If true, will remove existing environment variables
                        from the stack
  --prune-stack         Prune services that are no longer referenced
  --help                Show this message and exit.

来自python

如果您在本地运行portainer,这应该很容易使用 Docker,按如下方式连接:

fromportainer_pyimportportainer_for_hostportainer=portainer_for_host("http://localhost:9000")portainer.login("<username>","<password>")stack=portainer.stack_with_name("my-stack")try:portainer.update_stack(stack["Id"],"path/to/stackfile.yml",env_vars={"foo":"bar"})except:PortainerErroraserror:print(error.message)

许可证

portainer py是根据 MIT License

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Ant build中的java ZIP无法从基石LMS CSOD中提取   java使用数据库。requestDone()强制数据库连接返回连接池   Java:将字符串写入。txt发行   Java将项目从INT数组添加到字符串数组   Java Web开发IDE/服务器/文档   java在单击JCheckBox时添加值   安卓 Java ArrayIndexOutOfBounds数组映射异常   带数组字段的Java枚举   java错误的方法执行时间   Java如何将字符串数组中的所有字符合并为新字符串?   java如何安装jdt。eclipse中的核心在本地?   java RxJava:如何编写类似末日的代码?   java使用smartGWT客户端应用程序通过SOAP调用web服务操作   java从MFC程序中获取当前日期,并将其作为字符串传递给可执行jar文件   java使用JFileChooser?按钮&限制文件类型   未呈现Apache PDFBox Java库文本   多窗口的java JavaFX问题   java为什么会给出意外的返回值?