Docker Community Forums

Share and learn in the Docker community.

HTTPS From Docker

I have a VPS hosting a web app (Apache/2.4.46 without docker).

I’m interested in using the same VPS as a drone CI server as well, so I published it under port 8080 to avoid conflicts with Apache on standard ports (80,443).


Now, I can access


But cannot access


How can I use port 8080 for HTTPS (or leave it as HTTP and use another port as HTTPS)?

Thanks in advance.

the https part in the apache config is (usually) in a different config file, and as you said in a different port. Search for that config file in /etc/apache2/sites-available and change that 443 by, lest say, 8081. The basic setup includes a selfsigned certificate, so your browser will complain about that.

Thanks for the replay.
The point is, I don’t want to change port 443, I still need it to be HTTPS for my web apps.
So I need to keep 443 as HTTPS for my web apps, and 8081/8443 as HTTPS for my docker.

-p 8080:80 -p 8443:443

I’ve tried it with port 8080 in both cases.


Works, I could navigate to http://IP_ADDR:8080


Didn’t work, still could not navigate to https://IP_ADDR:8080

Do you know why?

Need more precision in “could not navigate”. ¿Error?
Are you publishing simultaneously 80 and 443 throw 8080? Try different ports.

Now I’ve tried with:


When I run “docker ps” I can see:

some_id drone/drone:1 “/bin/drone-server” 5 seconds ago Up 4 seconds>80/tcp,>443/tcp drone

When I use the browser to reach http://MY_VPS_ID_ADDRESS:8080/ The drone app is displayed.
But when I try reaching https://MY_VPS_ID_ADDRESS:8443/, I get “ERR_CONNECTION_REFUSED” error

Hmmm get into your server and check apache is listening at 443. also check connections to 443 are allowed by firewall or whatever is watching in your connection. May be those ports are required to be enabled somewhere. It’s being REFUSED, so let’s search for the origin of that rejection

Port 443 is used in every web app I store in this server, so Apache surly is listening to this port, and this port can’t be blocked in firewall.
Port 8443 is open as well,
I can see it by running:

nc -zvw3 SERVER_IP 8443

From my PC.

You need to configure your web server (inside the docker application) to enable HTTPS.
Open SSL port (443) on docker

You can consider using NGINX as a reverse proxy to your webserver and configure SSL in nginx
On a side, you can look at letsencrypt to get a free SSL certificate for your domain if this is a public site.