[lxc-devel] [pylxd/master] Improve documentation with a new container example

hsoft on Github lxc-bot at linuxcontainers.org
Sun Oct 16 17:51:29 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 684 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161016/3a2b1680/attachment.bin>
-------------- next part --------------
From ab9e8b9cc6083388d92196410c912a102dfcc063 Mon Sep 17 00:00:00 2001
From: Virgil Dupras <hsoft at hardcoded.net>
Date: Sun, 16 Oct 2016 13:46:17 -0400
Subject: [PATCH] Improve documentation with a new container example

I understand that the config specification for `create()` is beyond the
scope of the documentation, but I had to look directly in lxd's code to
figure how to create a container from a local image, something which, I
think, is a rather common usage of (py)lxd.

In this commit, I add an example of such config.

This additional example should be benefical to many other users.
---
 doc/source/containers.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/source/containers.rst b/doc/source/containers.rst
index e48af76..014288f 100644
--- a/doc/source/containers.rst
+++ b/doc/source/containers.rst
@@ -105,6 +105,10 @@ If you were to use an actual image source, you would be able to operate
 on the container, starting, stopping, snapshotting, and deleting the
 container.
 
+.. code-block:: python
+
+    >>> config = {'name': 'my-container', 'source': {'type': 'image', 'image': 'ubuntu/trusty'}}
+    >>> container = client.containers.create(config, wait=True)
     >>> container.start()
     >>> container.freeze()
     >>> container.delete()


More information about the lxc-devel mailing list