def execute(self, commands, out=sys.stdout):
        script_file = make_script_file(self.tmpdir, commands)
        script = '/mnt/script/{}'.format(script_file)
        session = self.docker.exec_create(self.container_id, script)
        session_id = session[u'Id']
        for output in self.docker.exec_start(session, stream=True):
            out.write(output)
        return self.docker.exec_inspect(session_id)[u'ExitCode']
Execute a set of commands in the Docker container.
dataset/ETHPy150Open ClusterHQ/flocker/admin/client.py/DockerContainer.execute