Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to run two different python api files running on different ports via a single container.

My docker file looks like:

FROM python:3.7-slim-buster

RUN apt-get update && apt-get install -y libgtk2.0-dev cmake libpoppler-cpp-dev poppler-utils tesseract-ocr

WORKDIR /app

COPY requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt 



COPY . .

RUN chmod a+x run.sh

CMD ["./run.sh"]

And the .sh file looks like:

#!/bin/bash

exec python3 /app1/numberToWord.py &
exec python3 /app2/dollarToGbp.py &

While the docker build is a success without any error, the docker run doesn't throw any error and exits the command line. I'm curios to know where is it failing, any insight is highly appreciated.

question from:https://stackoverflow.com/questions/65617505/running-two-separate-python-flask-api-via-a-single-docker-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
785 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try using nohup to ignore hangup signal

Ex:

#!/bin/bash

nohup python3 /app1/numberToWord.py &
nohup python3 /app2/dollarToGbp.py &

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...