Hi,
I'm trying to run two different instances of FastAPI in the same Kubernetes pod (different Docker containers), but I can't seem to find an easy way to change the default port 80 of the instances.
Obviously it is not possible to run 2 instances on the same port, so it would be easy if I could specify the wanted port in the Dockerfile or in the main.py file maybe.
Is it - in any way - possible to change the default port 80 while using the uvicorn-gunicorn-fastapi dockerfile?
Thanks!
@euri10 Since I'm using Kubernetes, I'm not calling Docker directly. I'm using a .yaml file for all configuration so I can't change options like that. However, since
-e PORT="8080"
is just a simple environment variable, I could try to add this variable to my yaml file. I'll update after trying.
Fixed it by specifying
env:
- name: PORT
value: '8081'
in my yaml file.
Might be something that could be added to the docs @tiangolo ? (here? https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#port)
glad it worked, i don't think it deserves an addition, -e and having an env
key in your yml be it kubernetes, swarm or docker-compose has the same
effect (or I dreamt too much today ?), there might be discrepancies in the
precedence order though.
On Thu, May 23, 2019 at 3:54 PM SansDK notifications@github.com wrote:
Fixed it by specifying
env: - name: PORT value: '8081'in my yaml file.
Might be something that could be added to the docs @tiangolo
https://github.com/tiangolo ? (here?
https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker#port)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/tiangolo/fastapi/issues/250?email_source=notifications&email_token=AAINSPT3PKXNQQJ5TMPK75TPW2OXZA5CNFSM4HPDRHJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWCJMYY#issuecomment-495228515,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAINSPS2CYFLK7FFQQNJRITPW2OXZANCNFSM4HPDRHJA
.
--
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
Thanks a lot for your help here @euri10 !
I'm glad you solved your issue @SansDK . Thanks for reporting back and closing the issue.
Most helpful comment
glad it worked, i don't think it deserves an addition, -e and having an env
key in your yml be it kubernetes, swarm or docker-compose has the same
effect (or I dreamt too much today ?), there might be discrepancies in the
precedence order though.
On Thu, May 23, 2019 at 3:54 PM SansDK notifications@github.com wrote:
--
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE