pip install docker-wrapper
Use it in a with statement:
with Docker() as docker:
docker.run('command')
or as a decorator:
@Docker.wrap()
def run_command_in_container(command, docker)
docker.run(command)
Read the documentation on docker-wrapper-py.readthedocs.org for more information about how to use this.
MIT © frigg.io