Skip to main content

Simple docker decorator

Project description


What is it ?

On top of docker, pydocktors is a simple way to declare a decorator to start and shutdown a docker container.

Why to use it ?

You can use it anywhere you want in your python code ! This include test and code…

For example, if you have a application that require a database (for example, MySQL or Neo4J) but you don’t want to install the database globally on your system, you can use the docker decorator !

Or you may need to load a application such as Nginx or Eureka when running your code locally without installing it, this docker decorator is made for you !


All of them are also available in the examples. Each example are designed to be independent.

Starting a Nginx with a your content and your configuration:

    ports=[(80, 8080)],
        (TARGET_DIR, '/usr/share/nginx/html', 'ro'),
        (NGINX_CONF, '/etc/nginx/nginx.conf', 'ro')
def main(container):
        'Nginx container with id %s is %s. Visit http://localhost:8080/',, container.status


Why this name ?
Because it’s the contraction of 3 famous words : python, docker and decorators
How did it came from ?

It will be a shame if a told you that I didn’t take inspiration from other Open Source project… In fact, as a Java developper, I was aware of this 2 projects :

But after some research, I wonder why there was no python decorator already made to run docker in python scripts. So, for my needs, I decided to do one and to share it !

I hope that it will be helpful for you to.

Authors : Patrick Allain License : MIT

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

pydocktors-0.0.7.tar.gz (6.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page