Unable to connect to confd daemon running in a container

Hello,
I have started a confd server in a container. I can see that the confd server is up and running. I am also able launch the CLI session on the default example port 4565 inside the container using the docker exec command. In the docker file i have exposed the port 4565 and also i have started the container by exposing the port 4565 to the host by using the -p option in docker run. But when i try to launch a confd_cli session from the host to connect to the confd server running in the container , i keep getting the error Failed to connect to server. I have followed the steps suggested in your confd user guide for docker/container.
Please note: docker ps shows the container is up and running and it shows the exposed tcp port 4565. Also netstat -auntp shows the port 4565 is in listening mode.

Can you please suggest what am i missing because of which i am not able to connect to confd server from the host machine.

Hi,

In your confd.conf make sure that the IPC IP address that ConfD binds to is 0.0.0.0, not the default 127.0.0.1. The default is 127.0.0.1 since normally you don’t want to expose the ConfD IPC port to the outside, but here you do since you want to access it from your Docker container host.

<confdIpcAddress>
  <ip>0.0.0.0</ip> <!-- default 127.0.0.1 -->
</confdIpcAddress>

If you want to use the ConfD CLI for development purposes you can do something like

$ docker exec -it my-container confd_cli -u admin -C

instead of exposing the 4565 port

You can also expose port 2024 instead of 4565 and ssh into the CLI:

$ ssh -l admin -p 2024 127.0.0.1

Is you container has a fixed ip? If so, you can try from the host

confd_cli -u -A < container-ip > -P <4565>

Of course, assume your container is running and can ping from the host.

PS: In my previous post the < container-ip > did not show if I did not have space from angle brackets

It works within the container also from the host! Thank you.

You can elaborate “works within the container from the host”?

You meant the same command “confd_cli -A blah -P blah” works within the container? I expect so. It should work from the host as well as container.

Yes , it works within the container. Alse with the new CONFD.conf i am able to launch CLI from the HOST too.

1 Like