使用docker-py执行shell命令
我试图在已经运行的容器上用docker-py运行一个shell命令,但是得到一个错误:
exec: "export": executable file not found in $PATH
以下是我编写脚本的方法:
exe = client.exec_create(container=my_container, cmd='export MYENV=1') res = client.exec_start(exec_id=exe)
所以我的问题是如何使用docker-py运行一个shell命令(在容器内)?