【问题标题】:Python file to execute commands in docker在 docker 中执行命令的 Python 文件
【发布时间】:2017-03-31 18:11:03
【问题描述】:

我想在单击按钮时 cd 到 docker 中的某个目录,所以我需要一个 python 命令来做到这一点,我试过了

os.system("sudo docker start jolly_allen ;sudo docker exec -i -t    jolly_allen /bin/bash ; sudo docker exec -i -t jolly_allen -c cd    /   tensorflow")

os.system("sudo docker run jolly_allen /bin/bash -c cd /tensorflow")

但没有任何效果。

谢谢!

【问题讨论】:

  • 尝试不使用sudo?将错误日志添加到您的问题中可能会有所帮助。
  • 你能补充更多细节吗?你是什​​么意思“什么都没有”,有什么错误吗?

标签: python linux bash docker


【解决方案1】:

探索 Docker Python 模块并享受乐趣: https://docker-py.readthedocs.io/en/stable/

【讨论】:

    猜你喜欢
    • 2015-06-07
    • 1970-01-01
    • 1970-01-01
    • 2017-10-03
    • 1970-01-01
    • 1970-01-01
    • 2019-01-23
    • 2019-10-22
    • 1970-01-01
    相关资源
    最近更新 更多