Skip to main content

Python wrappers for the docker CLI and configuring the Docker Daemon in Juju Charms

Project description

# Charms.Docker

[![Build Status](https://travis-ci.org/juju-solutions/charms.docker.svg?branch=master)](https://travis-ci.org/juju-solutions/charms.docker) [![Coverage Status](https://coveralls.io/repos/github/juju-solutions/charms.docker/badge.svg?branch=master)](https://coveralls.io/github/juju-solutions/charms.docker?branch=master)

This is a library intended to ease development of docker deliverable charms, by exposing an API that is easy to grok at an initial glance.

This library was borne from a disgust of mine at seeing many subprocess.check_call lines littered throughout charms. While functionally similar to what this library exposes, it should read better than many disjointed os exec calls.

This library is also targeted at python 3.3+

## To use charms.docker

This is actually embedded in the [layer:docker](http://github.com/juju-solutions/layer-docker) runtime layer. Unless you intend on hacking this, porting it elsewhere, or otherwise distrust the layer - you wont need to manually install this.

### Examples

#### Launch a one-off container

from charms.docker import Docker d = Docker() pid = d.up(‘lazypower/idlerpg:latest’, dirs={“files/idlerpg”:”/files/idlerpg”}, ports=[“8000:8000”]) payload-register(‘docker’, ‘application’, pid)

#### Launch a configured container, or many containers

But you wouldn’t really want to use this terribly often, as its more sensible to encapsulate the “configured state” of the container via a docker-compose yaml. Which is rumored to be simple to template, and then be used like so assuming the rendered template resides in $CHARM_DIR/files/workspace/docker-compose.yml:

from charms.docker import Compose c = Compose(‘files/workspace’) c.up()

### Get support

This project is under heavy development pending a 0.1.0 release. Until such time no methods should be assumed to be concrete until we land on a 1.0.0 release chain. Any charms based on this will be at the mercy of the author to stay abreast of the charm libraries changes.

Project details


Download files

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

Source Distribution

charms.docker-0.1.14.tar.gz (7.1 kB view details)

Uploaded Source

File details

Details for the file charms.docker-0.1.14.tar.gz.

File metadata

File hashes

Hashes for charms.docker-0.1.14.tar.gz
Algorithm Hash digest
SHA256 76efcc90561728c04b260d01488d56db441c0032f9183c1d76d37615b61ddd7f
MD5 a9ca13c75127b9000678c9f2156ae45b
BLAKE2b-256 765fa3b16d315289e914f9a8e5356181841951721339017c4a5310fc8c6c9dcf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page