1

I have a container running nifi (--name nifi) exposing port 8080 and another container running nifi registry (--name nifireg) exposing port 10808. I can get to both UI's, and I am able to connect nifi to the registry in the registry services by using the registry container's IP (172.17.0.5). These containers are also on a docker network called nifi-net. My issue is that the registry client is unable to talk to the registry when using the container name.

From the nifi I can ping by container IP as well as by name (ping nifireg), so there is some level of connectivity. But if I change the registry client to point to http://nifireg:180880 or even http://nifi-net.nifireg:18080 it clocks for a while and then eventually returns this error:

Unable to obtain listing of buckets: java.net.ConnectException: Connection refused (Connection refused)

What needs to be done to allow nifi to connect to the nifi registry using the container name?

EDIT: Here is how I set everything up:

docker run -d --name nifi -p 8080:8080 apache/nifi
docker run -d --name nifireg -p 18080:18080 apache/nifi-registry

I added the netorking after the fact, but that shouldn't be an issue.

docker network create nifi-net
docker network connect nifi-net nifi
docker network connect nifi-net nifireg
supahcraig
  • 109
  • 6
  • 2
    What commands exactly did you run to start the containers? Can you show the relevant fragment of application code that sets up the network listener in the server container (does it bind to 127.0.0.1, "only accept connections from within this container", or 0.0.0.0, "everywhere")? – David Maze Oct 27 '21 at 16:37
  • Edited the initial post to show the setup commands. – supahcraig Oct 27 '21 at 17:06
  • 1
    i'd use docker-compose where network automatically created .. – daggett Oct 27 '21 at 23:39
  • When I'm just playing around, I tend to spin up containers as I need them, this was my first attempt to link containers w/o using --link, but yeah, compose would solve this for sure. – supahcraig Oct 28 '21 at 18:09

2 Answers2

0

I don't understand why this solved the problem, but destroying the containers and recreating them with the --net nifi-net option at spin-up solved the problem.

docker run -d --name nifi --net nifi-net -p 8080:8080 apache/nifi
docker run -d --name nifireg --net nifi-net -p 18080:18080 apache/nifi-registry

The docs state that you can add them to a network after the fact, and I am able to ping from one container to the other using the name. I guess it's just a lesson that I need to use docker networking more.

supahcraig
  • 109
  • 6
0

I would suggest using docker-compose to manage the deployment since you can define the network once in docker-compose.yaml and not have to worry about it agian.

Plus it lets you learn about docker networking :P

mumf
  • 11
  • 5