Go无法创建RabbitMQ频道。 Docker容器上的RabbitMQ服务器,主机上的Go脚本

I'm running a RabbitMQ server on a docker container and I'm not able to open a RabbitMQ channel from the host machine.

The docker container is run from the RabbitMQ image this way, forwarding management ports and amqp port to the host :

docker run -d -p 5672:5672 -p 15672:15672 --hostname my-rmq --name rmq rabbitmq:3-management

The channel part of the go script is pretty straightforward :

ch, err := conn.Channel()
failOnErrorRmq(err, "Failed to open a channel")
defer ch.Close()

And I'm getting the following error

Failed to open a channel: write tcp [::1]:51937->[::1]:5672: use of closed network connection

I'm new to RabbitMQ. Any help on using RabbitMQ with Docker would be great.