This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

# python-docker-cloud

Python library for Docker Cloud

## Installation

In order to install the Docker Cloud Python library, you can use pip install:

pip install python-dockercloud

It will install a Python module called dockercloud which you can use to interface with the API.

## Authorization

The authentication can be configured in the following ways:

  • Manually set it in your Python initialization code:

    import dockercloud dockercloud.user = “username” dockercloud.apikey = “apikey”

  • Login with docker cli, and the library will read the configfile automatically:

    $ docker login

  • Set the environment variables DOCKERCLOUD_USER and DOCKERCLOUD_APIKEY:

    export DOCKERCLOUD_USER=username export DOCKERCLOUD_APIKEY=apikey

## Optional parameters

You may set the reconnection interval (Integer, in seconds) using the variable DOCKERCLOUD_RECONNECTION_INTERVAL:

export DOCKERCLOUD_RECONNECTION_INTERVAL=240

Session uses a socket that may be closed by some peer. To prevent the “Read timed out” issue you should use this option.

Possible values:

  • -1 (by default) means no reconnect (as usually it works)
  • 0 means reconnect on each request
  • any positive value means that the connection will be reopened if the time diff between last 2 requests is more than that value

## Namespace

To support teams and orgs, you can specify the namespace in the following ways:

  • Set it in the Python code:

    import dockercloud dockercloud.namespace = “yourteam”

  • Set it in the environment variable:

    export DOCKERCLOUD_NAMESPACE=yourteam

## Errors

Errors in the HTTP API will be returned with status codes in the 4xx and 5xx ranges.

The Python library will detect this status codes and raise ApiError exceptions with the error message, which should be handled by the calling application accordingly.

## Quick examples

### Services

>>> import dockercloud
>>> dockercloud.Service.list()
[<dockercloud.api.service.Service object at 0x10701ca90>, <dockercloud.api.service.Service      object at 0x10701ca91>]
>>> service = dockercloud.Service.fetch("fee900c6-97da-46b3-a21c-e2b50ed07015")
<dockercloud.api.service.Service object at 0x106c45c10>
>>> service.name
"my-python-app"
>>> service = dockercloud.Service.create(image="dockercloud/hello-world", name="my-new- app", target_num_containers=2)
>>> service.save()
True
>>> service.target_num_containers = 3
>>> service.save()
True
>>> service.stop()
True
>>> service.start()
True
>>> service.delete()
True

### Containers

>>> import dockercloud
>>> dockercloud.Container.list()
[<dockercloud.api.container.Container object at 0x10701ca90>, <dockercloud.api.container.Container object at 0x10701ca91>]
>>> container = dockercloud.Container.fetch("7d6696b7-fbaf-471d-8e6b-ce7052586c24")
<dockercloud.api.container.Container object at 0x10701ca90>
>>> container.public_dns = "my-web-app.example.com"
>>> container.save()
True
>>> container.stop()
True
>>> container.start()
True
>>> container.logs()
"2014-03-24 23:58:08,973 CRIT Supervisor running as root (no user in config     file) [...]"
>>> container.delete()
True
Release History

Release History

1.0.11

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.10

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python-dockercloud-1.0.11.tar.gz (31.3 kB) Copy SHA256 Checksum SHA256 Source May 10, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting