Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run ddev containers on port 80, solve port conflict

Tags:

ddev

Instead of using ddev share, I want to run ddev applications on a virtual server (Hetzner, Ubuntu installed, pre-installed docker ce).

As docker already reserved port 80: Is there a way to forward a specific ddev port to the same port listening to docker?

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1650/docker-proxy

My ddev test application is configured to port 8080 and is accessible.

The ddev configuration:

router_http_port: "80"
router_https_port: "443"
host_webserver_port: "8080"

If I change to

router_http_port: "80"
router_https_port: "443"
host_webserver_port: "80"

I'm (of course) running into

Failed to start test: Unable to listen on required ports, port 80 is already in use

Can this conflict be solved by forwarding a port (ddev router) or do I need to change the docker port?

like image 695
Mikel Wohlschlegel Avatar asked Nov 28 '25 18:11

Mikel Wohlschlegel


1 Answers

Docker itself does not use ports 80 or 443, so you have something else running there (the most common offender is going to be apache). The docs at https://ddev.com/s/port-conflict explain how to debug this. Since it says docker-proxy is running there, it probably means that you have a docker container already running and bound to port 80.

Try these things:

  • ddev poweroff (to make sure all ddev things are stopped)
  • docker ps -a will show you other containers that may be running
  • docker rm -f $(docker ps -aq) will stop all running containers.

I think when you do these things you'll find docker not listening any more; now you just have to find out why it was listening.

As you already know, the docs for various kinds of sharing are at https://ddev.readthedocs.io/en/stable/users/topics/sharing/ and you may also be interested in the general on-server approaches in https://ddev.readthedocs.io/en/stable/users/alternate-uses/#casual-project-webhosting-on-the-internet-including-lets-encrypt

like image 146
rfay Avatar answered Dec 02 '25 03:12

rfay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!