Using consul from my docker container

Hello:
I want to use Consul’s key/value store for my microservice configuration. I already have a 3 node cluster running and I also have my services connecting to one of the cluster nodes to get the parameters. It works great.
I want to be able to use the entire cluster and not just want IP, for reliability. I read that the recommended way to use consul in production is to deploy an agent next to my service (in the same docker container) and have the service connect to “localhost” instead of the remote IP.
This is where I need some help. I haven’t been able to deploy a consul agent in client mode joining a remote cluster. Looks like I need to deploy it in server mode instead but that means I need to allow bi-directional communication between my container and the other cluster. Is that correct?

You should be able to set up consul in agent mode next to your application and it should work as long as your retry_join config prop has the appropriate IPs. You would need bi-directional communication on all the recommended ports for Gossip etc.