Docker compose with Python input variable

84 views Asked by At

I am trying to get keyboard input with the cmd and according to the variable, I will do some calculations in the python file. Since I have 2 services in my docker yml file, I can't use the docker-compose run option. Is there a way to do it.

My docker compose file is:

services:
  postgres:
   image: postgres:13
   environment:
     - POSTGRES_USER=postgres
     - POSTGRES_PASSWORD=postgres
   ports:
     - "5432:5432"



   pg-admin:
     image: dpage/pgadmin4:6
     environment:
       - [email protected]
       - PGADMIN_DEFAULT_PASSWORD=admin
       - PGADMIN_LISTEN_PORT=5050

ports:
  - "5050:5050"


   pythonapp:
      build: ./
      tty: true
      stdin_open: true
      command: python3 ./main.py

Dockerfile :

FROM python:3.8

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY main.py ./


ENTRYPOINT ["python", "main.py"]
0

There are 0 answers