def run_python_container(self, cluster, address, docker_arguments, script,
                             script_arguments, cleanup=True, client=None):
        if client is None:
            client = get_docker_client(cluster, address)

        # Remove all existing containers on the node, in case they're left over
        # from previous test.  General cleanup provided by require_cluster
        # doesn't take care of this because these tests bypass the Flocker
        # container API and the general cleanup only cleans up Flocker
        # containers.
        for container in client.containers():
            client.remove_container(container["Id"], force=True)

        container = client.create_container(
            "python:2.7-slim",
            ["python", "-c", script.getContent()] + list(script_arguments),
            volume_driver="flocker", **docker_arguments)
        cid = container["Id"]
        client.start(container=cid)
        if cleanup:
            self.addCleanup(client.remove_container, cid, force=True)
        return cid
Run a Python script as a Docker container with the Flocker volume
dataset/ETHPy150Open ClusterHQ/flocker/flocker/acceptance/endtoend/test_dockerplugin.py/DockerPluginTests.run_python_container