Accessing dockerized memgraphdb using bolt-address

:bug: Bug Report

Description

(A clear and concise description of what the bug is.)
Access to memgraphdb that runs inside the container failing.

Steps to reproduce

Install memgraphdb container, pass the bolt-address and see you can access the mgconsole with by docker exec command or connect to memgraphdb from outside of the node.
(Write your steps here:)
Installed, running docker memgraphDB image

  1. created docker-compose.yml file to start the memgraphdb with entrypoint: [“/usr/lib/memgraph/memgraph”, “–log-level=TRACE”, “–memory-limit=50” ,“–bolt-address=10.xx.xx.xxx”]
  2. started docker using docker-compose up -d
    docker ps
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    e54abdf6c623 a3099c4ffebb “/usr/lib/memgraph/m…” 57 minutes ago Up 9 minutes 0.0.0.0:7444->7444/tcp, :::7444->7444/tcp, 0.0.0.0:7687->7687/tcp, :::7687->7687/tcp ssmemgraphdb
  3. see the running process
    ps -ef | grep mem
    2650167 2650146 1 19:09 ? 00:00:04 /usr/lib/memgraph/memgraph --log-level=TRACE --memory-limit=50 --bolt-address=10.xx.xx.xxx
  4. Yet, not able to access the mgconsole using
    docker exec -it --user root ssmemgraphdb mgconsole
    Connection failure: couldn’t connect to host: Connection refused

If i am not passing --bolt-address i am able to access the mgconsole or run application from different node

Expected behavior

(Write what you thought would happen.)

Actual behavior

If i am not passing bolt address i am able to access the mgconsole using docker exec , but i need my application that are running on different node needs memgraphdb access.

(Write what happened. Add full console log messages and screenshots, if applicable.)

Your environment

TRACE log:
2023-03-15 19:29:40.131] [memgraph_log] [info] Loaded module “/usr/lib/memgraph/query_modules/py_example.py”
[2023-03-15 19:29:40.131] [memgraph_log] [info] Loading triggers…
[2023-03-15 19:29:40.131] [memgraph_log] [info] Loading streams…
[2023-03-15 19:29:40.131] [memgraph_log] [warning] Using non-secure Bolt connection (without SSL). For more details, visit SSL errors | Memgraph Docs.
[2023-03-15 19:29:40.131] [memgraph_log] [error] Cannot bind to socket on endpoint 10.252.7.156:7687. For more details, visit Socket errors | Memgraph Docs.
[2023-03-15 19:29:40.131] [memgraph_log] [error] Listener failed on bind: Cannot assign requested address
[2023-03-15 19:29:40.184] [memgraph_log] [info] WebSocket server is listening on 0.0.0.0:7444
[2023-03-15 19:29:40.184] [memgraph_log] [info] Bolt server is fully armed and operational
[2023-03-15 19:29:40.184] [memgraph_log] [info] Bolt listening on 10.xx.xx.xxx
[2023-03-15 19:29:40.184] [memgraph_log] [error] Listener failed on accept: Invalid argument

  • Memgraph version used 2.5.2
  • Operating system and version (e.g., Ubuntu 20.04.2 LTS)

This is not port related, i tried installed pkg using dpgk this works fine and able to access from outside of node.

Hi! I think I don’t fully understand what is going wrong, but it seems to me that:

  • there is an issue with publishing docker ports → 7687 has to be published by e.g. by executing docker run ... -p 7687:7687 ... (docker-compose has an equivalent command)
  • Memgraph doesn’t support telnet protocol connection, Memgraph exposes the Bolt (preferred way of executing the queries) and WebScoket (primarily used to get real-time logs out of the system), take a look at Connect to Memgraph | Memgraph Docs to figure out what are the options to interact with Memgraph (Lab, mgconsole, language drivers)

Let me know if this helps :smiley:

We have published the port in docker-compse file ,

The issues is that I am able to access :7687 from outside of node when i am installed memgraph_2.6.0-1_amd64.deb and run memgraph using systemctl start .

If i do the same through container i could not access from outside of the node, even if i use -p 7687:7687

Is this IPV6 supported , i end up enabling port forwarding on iPV4 ( net.ipv4.ip_forward in sysctl.conf) able to access the memgraphdb from outside of docker node.

Thanks

Interesting. Could you share more details about what exactly you did and on which platform? Maybe we can include a note in Memgraph documentation :smile:

add or changed “net.ipv4.ip_forward=1” parameter in /etc/sysctl.conf
reload sysctl using command: sysctl -p

After this you can access 7687 port from outside, This looks like IP4 port forwarding is required when deployed memgraphdb in docker container, and not sure how IPV6 would work.

1 Like

Thank you so much for the details :pray:

As far as I know, we don’t have any IPv6 deployment yet, but I have some experience with IPv6 and will try it :smile: Keep you posted!