I have a REST api server developed with Python & Flask framework and deployed in the main server with Docker. When I build & start the docker container by sudo docker-compose build & sudo docker-compose up, the docker container starts at http://0.0.0.0:5000/ or localhost and using port 5000.
This works fine in non-ssl environment or browser or domain. But recently my main website (suppose www.example.com) started using ssl certificates. To communicate with main site I have to serve my apis in https instead of http.
Now I am trying to use this code to start server in https mode, but getting some errors.
My code :
import ssl
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ctx.load_cert_chain('certificate.pem', 'privateKey.pem')
.
.
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0',ssl_context=ctx)
Here is my error:
What will be the proper procedure to start Docker supported Python Flask app in https mode?
