Skip to content

Commit

Permalink
improve docs (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Barra committed Jul 22, 2017
1 parent d9a7871 commit 9c25559
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 11 deletions.
14 changes: 7 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# The default language to highlight source code in.
highlight_language = 'python3'

# -- Options for HTML output ----------------------------------------------

Expand All @@ -119,8 +121,6 @@
'github_button': True,
'github_type': 'star',
'github_banner': True,
'travis_button': True,
'codecov_button': True,
'pre_bg': '#FFF6E5',
'note_bg': '#E5ECD1',
'note_border': '#BFCF8C',
Expand All @@ -141,11 +141,11 @@
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars


# html_sidebars = {
# '**': [
# 'about.html', 'navigation.html', 'searchbox.html',
# ]
# }
html_sidebars = {
'**': [
'about.html', 'navigation.html', 'searchbox.html',
]
}

# html_sidebars = {
# '**': [
Expand Down
36 changes: 36 additions & 0 deletions docs/containers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
============
Containers
============


Create a container
========================

.. code-block:: python
import asyncio
import aiodocker
docker = aiodocker.Docker()
config = {
"Cmd": ["/bin/ls"],
"Image": "alpine:latest",
"AttachStdin": False,
"AttachStdout": False,
"AttachStderr": False,
"Tty": False,
"OpenStdin": False,
}
async def create_container():
container = await docker.containers.create(config=config)
print(container)
await docker.close()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(create_container())
loop.close()
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ The ``aiodocker`` package is written by Andrew Svetlov.
It's *Apache 2* licensed and freely available.




.. toctree::
:hidden:
:maxdepth: 2
:caption: Contents:


containers
services

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

34 changes: 34 additions & 0 deletions docs/services.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
============
Services
============


Create a service
========================

.. code-block:: python
import asyncio
import aiodocker
docker = aiodocker.Docker()
TaskTemplate = {
"ContainerSpec": {
"Image": "redis",
},
}
async def create_service():
service = await docker.services.create(
task_template=TaskTemplate,
name="my_service"
)
await docker.close()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(create_service())
loop.close()

0 comments on commit 9c25559

Please sign in to comment.