"getaddrinfo ENOTFOUND" when adding a data source

I am trying nocodb in docker.

I have a mysql server for which I have setup a specific username nocodb with a password. This user has all permissions on the object nocodb_test_1 database. The mysql server runs with container name mysql-prod-5.7.

I have launched a nocodb server also in docker. I have added it to the network with docker network connect mysql nocodb.

The nocodb server runs on the docker network mysql with container name nocodb.

Both machines are connected via the docker network. To test, I do docker exec -it nocodb sh and then inside ping mysql-prod-5.7 and the mysql responds.

(I prepared an image to set here but the forum does not allow me to upload images)

The mysql server is properly configured because if I enter from a client machine, like with docker run --rm -it --network mysql mysql bash and then inside I connect with mysql -h mysql-prod-5.7 -u nocodb -p and after hitting enter I paste the password, I may enter the MySQL machine. Then show databases; I see the nocodb_test_1. Then I use nocodb_test_1 and it works.

(I prepared a second image to set here but the forum does not allow me to upload images)

So conclusion:

  • MySQL properly setup, with a database and a user/pwd able to connect to that DB.
  • NocoDB container able to speak to the mysql container.

Then I in the frontend, I create a new connection and set all the parameters and then TEST the connection I get the “getaddrinfo ENOTFOUND”:

(I prepared a final image to set here but the forum does not allow me to upload images)

In the firefox debugger I truly see the frontend sending a POST request to the backend with the connection data.

How is it possible that the backend does not know how to resolve the host mysql-prod-5.7 when a ping actually works?

The only thing I may think if is that nocodb is using a non-mature library to resolve networking and as the name contains a dot, the library gets confused.

Any help on how to debug (and correct) this will be welcome!

PD: Solution cannot be “try a docker container with a name without a dot”.

Can you confirm all the connection params are fine and there is no duplicate NocoDB container running. And if possible share the screenshots in our discord channel - NocoDB | Discord , you can DM me directly as well ( @pranavxc )

Yes, I confirm I double checked it and even triple-checked it.

About container duplication => No. Only one single container was running.

One of the ways I checked the conenction was to open firefox, and copy from the POST request the host/user/pwd into the CLI and it worked, so really the params were good.

I’ll try to reproduce a “mininum case” with an empty mysql container (will try also with the dot thing and without) and when tested the “minimum case” I’ll show you back the “how to reproduce”.

About the discord, I even don’t know if I have discord installed or not. Will check.

Can you share a screenshot of the form which is filled with the connection values(ignore any confidential data)?

Thanks! Seems I now can upload images.

mysql-prod-5.7 is the mysql server container.

I’m going to upload the 3 images I pretended to upload in the first post.

Step #1: Checking credentials are right from another container

This is another container in the same network validating the connection credentials:

Thanks for sharing with annotation Nd error message, I will try to reproduce it locally with docker-compose and get back to you.

Step #2: Checking nocodb container has networking access to the mysql server

This is the verification that the nocodb container can see the mysql server container.

2023-10-25 00 31 21

Step #3 (failure) Trying to make nocodb to connect

This is the nocodb frontend:

1 Like

Thanks! I edited my post and set more images to clarify. Unfortunately the forum does not allow me to post more than 1 image per post and I had to place more replies that went after your reply.

Looking forward!

1 Like

Reproducible with following docker-compose

version: "2.1"
services:
  nocodb:
    depends_on:
      mysql-prod-5.7:
        condition: service_healthy
    environment:
      NC_DB: "mysql2://mysql-prod-5.7:3306?u=noco&p=password&d=root_db"
    image: "nocodb/nocodb:0.202.5"
    ports:
      - "8080:8080"
    restart: always
    volumes:
      - "nc_data:/usr/app/data"
  mysql-prod-5.7:
    environment:
      MYSQL_DATABASE: root_db
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: noco
    healthcheck:
      retries: 10
      test:
        - CMD
        - mysqladmin
        - ping
        - "-h"
        - localhost
      timeout: 20s
    image: "mysql:8.0.32"
    restart: always
    volumes:
      - "db_data2:/var/lib/mysql"
volumes:
  db_data2: {}
  nc_data: {}

It seems issue with knex or node-mysql2 client since connection is managed by these packages. I would suggest to remove the dot in container name.

Thanks for investigating.

I can’t do that. It’s a server where too many running applications connect to. Changing that name could potentially break too many dependencies.

I think docker does not put a restriction on the container name. And no other software has failed because of that “dot” in the name of the container for several years.

Are you active with the coomunity of the libraries you use? Maybe opening an issue or a pull-request to them could facilitate things.

The most I can imagine now is to temporarily set an alias in the /etc/hosts of the nocoDB and check if it works. And if so, maybe make nocoDB accept the hack via an env-var or so, so the bootstraping of the container patches the /etc/hosts.

Let me know and thanks for the interest in the case!

If it helps…

In the very same docker engine and connecting to the very same mysql with the “dot” name, I have another container that does connect well, indeed.

IDK if the underlying technology/language is the same than you use in nocoDB, but maybe looking at that open-source, it could serve as potential inspiration about what connection libraries they use.

I’m talking about “budibase” and as you can see in the image, it properly connects to the mysql-prod-5.7 (with the dot):