Traefik + GitLab Docker = Bad Gateway due to ports issue

Hello,

I have a Rocky Linux 9.x install running Docker version 26.1.0, build 9714adc and Traefik 2.10.1. I installed the latest GitLab Docker using the compose file from here (github.com)

I left all the values in the .env file as is except for the hostnames (which I changed to my domain names). I then ran docker compose up -d and everything worked fine. The GitLab instance showed up and I was able to use it as normal. However, when I restarted the GitLab docker, I got a Bad Gateway message. After many hours I figured out how to get past this issue. It seems like every time I restart the GitLab docker, I have to change the ports in the .env file. If I don't change the ports, then Traefik shows a Bad Gateway error. If I change all 3 ports to something new then it works fine.

This GitLab docker instance works fine with other reverse proxies. It seems the bad gateway is happening only on Traefik. Any ideas how to fix this?

Edit: I am running a lot of other containers on the same server with this same configuration. None of them have this issue.

Thanks.