Docker Community Forums

Share and learn in the Docker community.

Docker-compose Ports forwarding twice

I’m having an issue which I am struggling to troubleshoot.

I’m ssh-ing into a remote machine and running docker-compose up on a docker-compose.yaml file whcih has a port key of 80:80.

I run this and I can’t access the endpoint and when I ran docker inspect on the container I see two forwarded ports for port 80.

"Ports": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "80"
                    },
                    {
                        "HostIp": "::",
                        "HostPort": "80"
                    }
                ],

It seems like the second instance is overwriting the first but I have no idea why its even there.

Please help

The first definition is IPv4 and the second definition is IPv6. I think you could try to forward the port like this:

  ports:
    - "0.0.0.0:80:80"

Thank you.

I actually figured out it has something to do with my traefik config.
Haven’t figured out what yet.

Why do you think that? Other containers work with port forwarding except traefik?

Yes, and when I exec into the container in question everything is up and running as it should. I just can’t seem to figure out the Traefik configuration