Consul with docker in development environment

Hello!

I’m trying to set up consul on my dev machine with docker.
When I start it with
docker run -d -p 8500:8500 --name=dev-consul -e CONSUL_BIND_INTERFACE=eth0 consul
everything works fine, the ui is reachable from localhost:8500. But, obviously, consul can’t reach my services and can’t perform health checks.

So, I added --net=host:
docker run -d --net=host --name=dev-consul -e CONSUL_BIND_INTERFACE=eth0 consul
It started successfully, but the ui and api were unreachable (connection refused). I checked Resource Monitor and there weren’t any services that listened on 8500 port.

I tried different options (like server agent bind client -ui) from documentation but it still doesn’t work.

How can I correctly run dev version of consul with --net=host flag?
I want it to be available at localhost:8500 and to be able to see all my local services.

1 Like

I ran your exact docker run -d --net=host --name=dev-consul -e CONSUL_BIND_INTERFACE=eth0 consul command and it worked perfectly fine in my localhost with port 8500 open and accepting UI.

1 Like