Skip to main content

Python based Assistance for Docker

Project description

Tsaotun - Python based Assistance for Docker

** I can't figure out why I would need this **

In traditional ways, we make aliases ourselves all over the Docker commands.

The reason why I develop this project is to encourage people to contribute and share their ideas and thoughts into plugins, which would give Tsaotun ability to do those things. And, the aboved thing is just one of things that Tsaotun can achieve, you will be able to load variety of plugins in the future as well.
Besides, if you are doing some projects involved running containers, Tsaotun has provide the higher level API for you. That is another helpful functionality.

Currently, I'm moving my previous project `VWGen <>`_ into one of Tsaotun's plugin. Once I finish, everyone can just load the plugin and extend the power of Tsaotun.

.. class:: no-web

.. image::
:alt: Higher level API
:width: 100%
:align: center

.. class:: no-web no-pdf

|pypi| |unix_docker| |mac_docker| |windows_docker|

.. contents::

.. section-numbering::

Main features

* Run any commands docker can run on Tsaotun
* All written in Python with love of API of docker
* Simplify the process making your own implementation of docker command line tool
* Many Addons are upcoming

Installation (All platforms)


A universal installation method (that works on Windows, Mac OS X, Linux, …,
and always provides the latest version) is to use `pip`_:

.. code-block:: bash

# Make sure we have an up-to-date version of pip and setuptools:
$ pip install --upgrade pip setuptools

$ pip install --upgrade tsaotun

(If ``pip`` installation fails for some reason, you can try
``easy_install tsaotun`` as a fallback.)

Docker hub

Pull from `dockerhub`_, or build it yourself:

.. code-block:: bash

$ docker build -t tsaotun .

Verify that now we have installed the latest version, for example:

.. code-block:: bash

$ tsaotun version
Version: 0.8.1
Python version: 2.7.13
OS/Arch: Darwin/x86_64

Version: 1.13.0-rc7
API version: 1.25 (minimum version 1.12)
Go version: go1.7.3
Git commit: 48a9e53
Built: 5 days ago
OS/Arch: linux/amd64
Kernel version: 4.9.3-moby
Experimental: True


Hello World:

.. code-block:: bash

$ tsaotun [COMMAND]


.. code-block:: bash

$ tsaotun [-h] [--console] [--color] [--debug] [--dry] [--host list]

See also ``tsaotun --help``.


Addon feature is testing right now, and each addon should has its own folder with ```` inside.

Addon folder struture shows like:


├── addon_A -, ...
├── addon_B -, ...

Best practices (Sample addon to remove "ALL" containers at once, no matter it's dead or alive)

** To specify how to override the original command **

.. code-block:: python

"""Configuration file for this addon"""

from .Container import rm

__override__ = {'Container.rm': 'Rm'}
__argparse__ = [
'namespace': "Container",
'position': "Child",
'subcommand': "rm",
'actions': [
"add_argument('--clear', \
action='store_true', \
dest='clear', \
help='Remove all dead and alive containers. \
You still need to give a whatever container ID.')",

** Container/ **

.. code-block:: python

"""This module contains `docker container rm` class"""

from docker.errors import APIError
from tsaotun.lib.Docker.Container.command import Command
from tsaotun.cli import Tsaotun

class Rm(Command):
"""This class implements `docker container rm` command"""

name = "container rm"
require = []

def __init__(self):
self.settings[] = None

def eval_command(self, args):
containers = args["containers"]
clear = args["clear"]
del args["containers"]
del args["clear"]
Ids = []
if clear:
cli = Tsaotun()
cli.send('ps -a --format {{Id}}')
ress = cli.recv()
if ress:
ress = ress.split('\n')
ress = [res[0:4] for res in ress]
for Id in ress:
args['container'] = Id
for Id in containers:
args['container'] = Id
self.settings[] = '\n'.join(Ids)

except APIError as e:
raise e

def final(self):
return self.settings[]


Apache License v2.0: `LICENSE <>`_.


`Boik Su`_ (`@qazbnm456`_) created Tsaotun.

.. _pip:

.. _dockerhub:

.. |pypi| image::
:alt: Latest version released on PyPi

.. |unix_docker| image::
:alt: Compatible on Linux

.. |mac_docker| image::
:alt: Compatible on Mac

.. |windows_build| image::
:alt: Compatible on Windows

Project details

Download files

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

Files for tsaotun, version 0.8.2
Filename, size File type Python version Upload date Hashes
Filename, size tsaotun-0.8.2-py2.py3-none-any.whl (68.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size tsaotun-0.8.2.tar.gz (37.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page