Installing Mattermost via Docker issues

Hello, I am following the steps described here Install Mattermost via Docker — Mattermost documentation to deploy mattermost on my server on Ubuntu 22.04 LTS with Docker

And I get stuck with the 4th step
after running this command, scripts/issue-certificate.sh

I get the following error message:
docker: Error response from daemon: driver failed programming external connectivity on endpoint certbot (f1a8ea7c08d8139ab83a4d373a141bd1f9677f89e512ece94227b7ac6caca261): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.

I guess this happens because 80 port is used by the proper Docker and I tried to pause the Docker container, but it did not help

Mattermost container is 8065 (you can see in your screenshot).

Something else on your host machine is using 80. Maybe nginx?

Try
sudo lsof -i :80

Thank you for the answer.

Yes, it seems that 80 is a default port for nginx.

COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx      565     root    8u  IPv6  19992      0t0  TCP *:http (LISTEN)
nginx      565     root    9u  IPv4  19993      0t0  TCP *:http (LISTEN)
nginx   120574 www-data    8u  IPv6  19992      0t0  TCP *:http (LISTEN)
nginx   120574 www-data    9u  IPv4  19993      0t0  TCP *:http (LISTEN)

Tried to google how to change it. Found this article https://utho.com/docs/tutorial/how-to-change-nginx-port-in-linux/ but I don´t see listen conf in my config, it looks like this

Not sure if /etc/nginx/nginx.conf is the right place to change it anyway

Look into a reverse proxy like traefik or caddy

I am not familiar with that issue-certificate.sh script but from the error message it looks like it’s trying to launch certbot and possibly a webserver in Docker and on port 80?

If that’s the case this might be your issue. You could try to run certbot directly on your Ubuntu host, at least that’s what I do, or maybe change the port for certbot inside that script. In that case you will likely need a corresponding nginx config for certbot pointing to the new port

Changing nginx away from port 80 isn’t the right approach in my opinion, because you want your incoming clients to talk to the nginx reverse proxy on port 80 and 443 (redirecting to Mattermost on 8065) and not to certbot.