linux下如何编写shell命令,使其自动进入容器内执行python脚本

linux下如何编写shell命令,使其自动进入容器内执行python脚本

问题描述:

想编写一条shell命令,可以实现自动化。python脚本在容器内,查了下只有用docker exec -it containerId bash -c "python test.py -m 1"
命令实现。但是出问题了(容器内手动执行"python test.py -m 1"是ok的),使用此shell命令执行时,运行的python环境与在容器内执行python脚本时的环境不一样,导致执行这条shell命令报错。有没有解决的办法?