Add more examples
Add examples for the items I just learned about, how to specify a profile, an image
source, and find out what IP address a machine is using.
@@ -118,6 +118,15 @@ container.
>>> container.delete()
+Config line with a specific image source and a profile.
+
+.. code-block:: python
+
+ >>> config = {'name': 'my-container', 'source': {'type': 'image', "mode": "pull", "server":
+ "https://cloud-images.ubuntu.com/daily", "protocol": "simplestreams", 'alias': 'bionic/amd64'},
+ 'profiles': ['profilename'] }
+
+
To modify container's configuration method `save` should be called after
:class:`~container.Container` attributes changes.
@@ -126,6 +135,14 @@ To modify container's configuration method `save` should be called after
>>> container.devices = { 'root': { 'path': '/', 'type': 'disk', 'size': '7GB'} }
>>> container.save
+To get state information such as a network address.
+
+.. code-block:: python
+
+ >>> addresses = container.state().network['eth0']['addresses']
+ >>> addresses[0]
+ {'family': 'inet', 'address': '10.251.77.182', 'netmask': '24', 'scope': 'global'}
+
Container Snapshots
-------------------
