Python webserver in Docker on nonstandard port

Hi there,
I am new here and I am not sure I am hijacking a topic. If so please apologize and point me in the right direction. Here is my question.

I have a http service running in a docker instance on port 8888.
The service is written in python with aiohttp and has only a handful routes defined.
I would like to convert it to a https service on port 8443

How can I get a certificate for this configuration?

1 Like

@leonardoda

Welcome to the Let’s Encrypt Community, Leon :slightly_smiling_face:

There are three things you need to do:

  • Run software to obtain the certificate
  • Obtain the certificate
  • Install the certificate

Under Docker, the first two things are very simple. There are official containers and docs for running Certbot under Docker (see bleow). You’ll be able to complete challenges via the HTTP-01 mechanism (Port80); you can also opt to use the DNS-01 challenge and run Certbot from any computer that can manage DNS.

If you use Docker or elect to run an ACME client to handle DNS-01 challenges from your computer, you must manually install the certificates. This is because Certbot’s Docker container is sandboxed from your Application’s Docker container.

In terms of installing the certs and running services, you could have the Python app handle SSL termination, you could run it in a container that handles SSL termination (uwsgi, gunicorn, etc), or you could install a webserver to run on port 80/443 (nginx and caddy are popular) and then proxy the traffic to your app on the higher port.

Hope this helps!

2 Likes

Thank you for the quick response.
I was unsure about acquiring the certificate via a second docker instance.
Installing the certificate is just providing the correct files to the software.

Again thank you, this is a good experience

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.