7

I'm trying to update an SSL certificate on digital ocean with the command certbot renew But I get this error:

Problem binding to port 80: Could not bind to IPv4 or IPv6.

running netstat -plunt shows that port 80 is been used by 'docker-proxy'.

What can I do to fix this should I stop docker-proxy how do I do that?

Harry
  • 1,021
  • 4
  • 21
  • 41
  • your certbot is trying to bind to port 80 it looks like, never used nginx/apache plugin, not sure if they actually try spinning up server of their own, sure, stop container, try renewing, start it again – Dusan Gligoric Sep 23 '19 at 14:56
  • Thanks stoping and starting docker solved the problem – Harry Sep 23 '19 at 15:22

5 Answers5

12

Try this.

systemctl stop apache2.service 
Ahmed Tounsi
  • 1,482
  • 1
  • 14
  • 24
  • Please add some explanation to your answer such that others can learn from it. How is this related to Docker after all? – Nico Haase May 02 '20 at 20:08
4

You just need to stop all running servers like Apache, nginx before doing this.

Stop Nginx

sudo systemctl stop nginx

Stop Apache2

sudo systemctl stop apache2

Here is details information of prefix

--apache          Use the Apache plugin for authentication & installation
--standalone      Run a standalone webserver for authentication
--nginx           Use the Nginx plugin for authentication & installation
--webroot         Place files in a server's webroot folder for authentication
--manual          Obtain certificates interactively, or using shell script hooks
Kalyan Halder
  • 1,485
  • 24
  • 28
3

The docker-proxy is the user space port forwarding process used by docker when you publish a container's port. Run a docker container ls to show all running containers, along with the ports each may be publishing, and stop the container listening on the ports you want to use.

BMitch
  • 231,797
  • 42
  • 475
  • 450
3

This error means you have a web server running on the port on which Certbot is attempting to renew your ssl cert. Figure out what's running and stop that process. Keep in mind you may have port forwarding rules on your host.

duhaime
  • 25,611
  • 17
  • 169
  • 224
0

I had a similar error once, while I was trying to get a certificate with Certbot. The problem was also because an application was listening on port 80, then Certbot can't listen on that port.

In my case, I found out that HAProxy was running on port 80 after I checked the process.

$ sudo netstat -tlnp
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1031/haproxy   

I stopped the haproxy from running on port 80.

$ sudo service haproxy stop

And it worked. I was able to get the certificate.