ddev

Run ddev containers on port 80, solve port conflict


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?


Solution

  • 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:

    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