挂载多个目录给docker

def run_docker(self, input_desc, img_name, cmd_args, output_path, tool_id):
        docker_cmd = 'docker run --rm {mount_files} {img} sh -c {cmd}'
        mount_files = '-v ' + output_path + ':/mnt/analytix_output'
        for i in input_desc:
            mount_files += ' --mount type=bind,source=' + i[1] + ',target=' + i[1]
        docker_cmd = docker_cmd.format(mount_files=mount_files, img=img_name,
                                       cmd="'cd /mnt/analytix_output && " + cmd_args + "'")
        self._update_log(docker_cmd.replace(STORAGE_DIR, '***'))
        self._update_wf_args({'args': docker_cmd, 'id': tool_id})
        self.runbyPopen(docker_cmd, 'docker run')

 

posted on 2024-08-07 11:08  我和你并没有不同  阅读(1)  评论(0编辑  收藏  举报