santosh kumar
santosh kumar

Reputation: 77

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. How can i get it executed in python container every time it is fetched and get the output back to local??

Upvotes: 3

Views: 278

Answers (1)

Ohad the Lad
Ohad the Lad

Reputation: 1929

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

Upvotes: 1

Related Questions