ConfD User Community

APP communication with CONFD running in docker

I have CONFD up and running in a container. I am able to connect to it using confd_cli from the HOST.
confd_cli -A --port=4565 --user=admin
In the above command container-ip is the ip address of the container running CONFD.

I wanted to run the executable which gets created in the examples.confd/intro/10-c_transform/build/user-storage-trans-app in a container make it connect to the container running the CONFD.
I changed the inet_addr to 0.0.0.0 in the source code of the executable user-storage-trans-app, but it is not able to connect to the container running the CONFD. Should i use the ip address of the container running the CONFD instead of the 0.0.0.0?
What sort of docker network would you suggest if i want to have 2 containers communicating with each other , one container runs the CONFD and other runs a daemon which tries to connect to the CONFD.

You are asking for is Docker support here, not ConfD support.

There is a demo on the ConfD Dev GitHub that is close enough to use as a reference called confd-nso-interop.

Start with the setup.sh and note how the two containers and a network for them are created.

Then see the Dockerfile.confd and the run.sh script it executes after installing ConfD. Change the exposed port to 4565 instead of 2022 if you are connecting using IPC (not NETCONF).
In the Dockerfile, and run.sh script that it executes, replace the NSO setup and application with your setup of your application of choice.

Hello, i have tried out the following after looking at the example you have shared:

Created a dockerfile for CONFD which just starts the confd server “/confd/bin/confd --foreground --conf confd.conf --addloadpath <>”
docker container using this docker image comes up and i am able to access the CONFD from HOST using CLI.
I have created the docker container on a docker network “trialnetwork”.

For the confd daemon , i have taken the example 10-c_transform . I have created a docker image which when started will just create a bash session. this will keep the container alive. i have used docker run command like below:

docker run --net naveennet -it --name confdhandler -d -p 5000:5000 --volume /home/naveen/confd-7.5.1/examples.confd/intro/10-c_transform:/confd/apps confdproc bash

Both the containers are running in the same network. And Docker inspect command on network also shows the name of both the containers.

root@naveen-VirtualBox:/home/naveen/confd-7.5.1/examples.confd/intro/10-c_transform/build# docker network inspect 9f879c83663b
[
    {
        "Name": "naveennet",
        "Id": "9f879c83663b8027cfb809899492684c9d1510d38073421c3cc81180e0495f28",
        "Created": "2021-06-17T11:33:10.446580286+05:30",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "8d0e94c83e3f45d7c7284334350fa752294f97289ad1e8617315e0a758552f42": {
                "Name": "confdcontainer",
                "EndpointID": "63fdec05c7e0e32820fd6c1d4beb9700a20c59bbf23fc9ba01a5bc32c8d31564",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            },
            "9dd0c5be6900190f8b88bfa0fa55e77b539a312fbe84f5cfe0fa1b52188ff458": {
                "Name": "confdhandler",
                "EndpointID": "2ba05ddbcec29ae9238e96d08765ea34c766f1c229a7bf5cc27a15a76fdbdc2a",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

Then i access the 2nd container (confdhandler) using docker exec command. And in the container session i start the proc ./user-storage-trans-app
I get the same error:

**DEBUG Failed to connect to ConfD: Connection refused**
**Failed to load schemas from confd**

Please note: I am able to access the CONFD server running in the container from the host. I am seeing this issue only when i try to establish connections between confd daemon running a container with a confd server running in another container.

I am able to connect to the CONFD server from another container (confdhandler) by trying the below command:
/confd/bin/confd_cli --address=172.18.0.2 --port=4565 --user=admin
In the above command “172.18.0.2” is the ip address of the container running the confd server.

Do i need to change the daemon connect to the ip-address of the container running the CONFD server?
Or do i need to make the confd server into a service and use that for connecting from container with daemon?

Your inputs will be really very helpful.