Consul server with persisted data for windows dev

Hi 'im trying to get a simple docker consul server running on my windows 10 dev computer

tried something like that

docker run --net=host -e CONSUL_BIND_INTERFACE=eth0 -v c:\dev\consul\data:/consul/data -v c:\dev\consul\config:/consul/config -p 8500:8500 consul agent -server -bootstrap -ui-dir /ui

but I cannot access localhost:8500/ui on my web browser
things are persisted in the data directory, I can even curl the 8500/ui inside the container and it respond well.

I’ve tried a lot of combinaison without --net=host with differents address but cannot access to the ui :frowning:

Hi @bodtx,

Welcome to the forum!

Consul by default binds the client interfaces (HTTP & DNS) to 127.0.0.1. You can make Consul listen on a non-loopback interface by setting CONSUL_CLIENT_INTERFACE=eth0.

Hope this helps.

Ref: docker-consul/docker-entrypoint.sh at eac0f7bd73879c55aa8abac4cd4beab38c6b8060 · hashicorp/docker-consul · GitHub

1 Like

Hi, I’ve already put this in my command:
CONSUL_CLIENT_INTERFACE=eth0

it does not help

BTW note that this works

docker run -d --name=dev-consul -e CONSUL_BIND_INTERFACE=eth0 consul

but as soon as I tried to get it in server to persiste data it does not work:

docker run --name=dev-consul -p 8500:8500 -e CONSUL_BIND_INTERFACE=eth0 -v c:\dev\consul\data:/consul/data -v c:\dev\consul\config:/consul/config consul agent -server

Unfortunately, I don’t have a Windows box to try this. The below commands works for me on macOS with Docker Desktop.

$ docker run -e CONSUL_CLIENT_INTERFACE=eth0 \
             -e CONSUL_BIND_INTERFACE=eth0 \
             -v ${HOME}/Downloads/consul/data:/consul/data \
             -v ${HOME}/Downloads/consul/config:/consul/config \
             -p 8500:8500 \
             consul agent -server -bootstrap -ui
1 Like

yes it works sorry I’ve miss understood your first post, I took this for

-e CONSUL_BIND_INTERFACE=eth0 

so with this command, it works on windows and persiste the data:

docker run --name=dev-consul -p 8500:8500 -e CONSUL_BIND_INTERFACE=eth0 -e CONSUL_CLIENT_INTERFACE=eth0 -v c:\dev\consul\data:/consul/data -v c:\dev\consul\config:/consul/config consul agent -server -bootstrap -ui
1 Like