[英]how to send python file to docker container(using python image) and get the output back to local
i have a program which fetches the python code as string.我有一个程序将 python 代码作为字符串获取。 How can i get it executed in python container every time it is fetched and get the output back to local??
每次获取它并让 output 回到本地时,我怎样才能让它在 python 容器中执行?
You may do this via docker yml (docker-copose)您可以通过 docker yml (docker-copose) 执行此操作
services:
server:
command: bash -c "python3 manage.py migrate; python3 manage.py runserver 0.0.0.0:8000; tail -f /dev/null;"
ports:
- "8000:8000"
Or in Dockerfile:或在 Dockerfile 中:
RUN python3 manage.py migrate
If the python code is a string maybe try using EVAL command:如果 python 代码是字符串,可以尝试使用 EVAL 命令:
https://www.programiz.com/python-programming/methods/built-in/eval https://www.programiz.com/python-programming/methods/built-in/eval
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.