Cannot bind on IPv6 address

I have VETH interface configured for dual-stack:

/interface/veth/add name=veth-ipv6bug address=192.0.2.1/31,2001:db8::1/127 dhcp=no gateway=192.0.2.0 gateway6=2001:db8:: ...

When I point app to bind on [::], 0.0.0.0 or 192.0.2.1 there is no problem. But pointing it to 2001:db8::1 fails, in my case, with listen tcp [2001:db8::1]:8080: bind: cannot assign requested address

When bound to [::] or 0.0.0.0 the container can be reached via either address.

I'm on RouterOS 7.24.1

EDIT

Dockerfile to reproduce:

FROM golang:1.26.7 AS build
WORKDIR /src
COPY <<EOF /src/main.go
package main

import (
	"net"
	"os"
)

func main() {
	l, err := net.Listen("tcp", os.Args[1])
	if err != nil {
		panic(err.Error())
	}
	_, _ = l.Accept()
}

EOF
RUN sh -c 'CGO_ENABLED=0 go build -v -ldflags="-s -w" -o app main.go'

FROM gcr.io/distroless/static-debian12
COPY --from=build /src/app /bin/app
USER root
WORKDIR /bin
EXPOSE 53 53/udp
ENTRYPOINT ["/bin/app"]

Then you can use cmd to specify listening address:

/container/add ... cmd="[2001:db8::1]:8080"

I don't know if this is what's causing your particular issue, but surely configuring the ipv6 address and the gateway as being the same can't be good. Maybe you meant for gateway6 to be ::0?

Unfortunately it's just a typo in the post