how to send python file to docker container(using python image) and get the output back to local

Viewed 206

i have a program which fetches the python code as string. How can i get it executed in python container every time it is fetched and get the output back to local??

1 Answers

You may do this via 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:

RUN python3 manage.py migrate

If the python code is a string maybe try using EVAL command:

https://www.programiz.com/python-programming/methods/built-in/eval

Related