# Dockered Neo4j community error trying to bind to public IP address

**URL:** <https://community.neo4j.com/t/dockered-neo4j-community-error-trying-to-bind-to-public-ip-address/65523>\
**Category:** Server\
**Tags:** configuration, connection, docker\
**Created:** [December 27, 2023, 4:54pm UTC](https://community.neo4j.com/t/dockered-neo4j-community-error-trying-to-bind-to-public-ip-address/65523 "2023-12-27T16:54:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apoloduvalis](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/apoloduvalis/32/30377_2.png) [@apoloduvalis](https://community.neo4j.com/u/apoloduvalis)\
**Post date:** [December 27, 2023, 4:54pm UTC](https://community.neo4j.com/t/dockered-neo4j-community-error-trying-to-bind-to-public-ip-address/65523/1 "2023-12-27T16:54:44Z")

</div>

I need to access remotely to a dockered Neo4j using the public IP address, but when I configure the IP address via parameters, the connection through http via 7474 port fails and neo4j.log shows these exceptions:

> org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.bolt.protocol.common.connector.netty.SocketNettyConnector@2548fc01' was successfully initialized, but failed to start. Please see the attached cause exception "bind(..) failed: Cannot assign requested address".
> 
> org.neo4j.configuration.helpers.PortBindException: An error occurred while trying to bind to the socket /\<server\_public\_IP\>:7687
> 
> io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Cannot assign requested address

The server is running on an AWS virtual server with these settings:

> Virtualization: amazon  
> Operating System: Ubuntu 22.04.3 LTS  
> Kernel: Linux 6.2.0-1017-aws  
> Architecture: arm64

I am using the latest [docker image for neo4j 5.15.0](https://hub.docker.com/layers/library/neo4j/5.15.0/images/sha256-49209c959ae23185b7625d0f9185b59cb82269f2dfbeba266376afd1f55d4ed9?context=explore)

As instructed in the [Operations manual](https://neo4j.com/docs/operations-manual/current/docker/configuration/), and [this post](https://community.neo4j.com/t/remote-neo4j-server-port-7474-connection-refused/30058) the command I am using to create and run the container with the neo4j image is:

> sudo docker run -d   
> --name=neo4jdocker   
> --restart always   
> --publish=7474:7474 --publish=7687:7687   
> --env NEO4J\_AUTH=neo4j/   
> --env NEO4J\_server\_memory\_heap\_initial\_\_size=12288m   
> --env NEO4J\_server\_memory\_heap\_max\_\_size=20480m   
> --env NEO4J\_server\_default\_\_listen\_\_address=0.0.0.0   
> --env NEO4J\_server\_default\_\_advertised\_address=\<server\_public\_IP\>   
> --env NEO4J\_server\_bolt\_enabled=true   
> --env NEO4J\_server\_bolt\_tls\_\_level=DISABLED   
> --env NEO4J\_server\_bolt\_listen\_\_address=0.0.0.0:7687   
> --env NEO4J\_server\_bolt\_advertised\_\_address=\<server\_public\_IP\>:7687   
> --env NEO4J\_server\_http\_enabled=true   
> --env NEO4J\_server\_http\_listen\_\_address=0.0.0.0:7474   
> --env NEO4J\_server\_http\_advertised\_\_address=\<server\_public\_IP\>:7474   
> --env NEO4J\_server\_https\_enabled=false   
> --volume=/home/ubuntu/ocean\_route\_prediction/data:/data   
> --volume=/home/ubuntu/ocean\_route\_prediction/import:/import   
> --volume=/home/ubuntu/ocean\_route\_prediction/logs:/logs   
> --volume=/home/ubuntu/ocean\_route\_prediction/plugins:/plugins   
> neo4j:5.15.0

Then the Neo4j finds something wrong and tries to restart:

> sudo docker ps
> 
> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
> 2a641248b8d9 neo4j:5.15.0 "tini -g -- /startup…" About a minute ago Restarting (1) 18 seconds ago neo4jdocker

On the other hand, when I create the container without the public IP configuration settings, everything works as expected locally at the server machine:

> sudo docker run -d   
> --name=neo4jdocker   
> --restart always   
> --publish=7474:7474 --publish=7687:7687   
> --env NEO4J\_AUTH=neo4j/   
> --env NEO4J\_server\_memory\_heap\_initial\_\_size=12288m   
> --env NEO4J\_server\_memory\_heap\_max\_\_size=20480m   
> --env NEO4J\_server\_default\_\_listen\_\_address=0.0.0.0   
> --volume=/home/ubuntu/ocean\_route\_prediction/data:/data   
> --volume=/home/ubuntu/ocean\_route\_prediction/import:/import   
> --volume=/home/ubuntu/ocean\_route\_prediction/logs:/logs   
> --volume=/home/ubuntu/ocean\_route\_prediction/plugins:/plugins   
> neo4j:5.15.0

Docker reports everything ok:

> sudo docker ps
> 
> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
> f5432bafedd5 neo4j:5.15.0 "tini -g -- /startup…" 34 minutes ago Up 34 minutes 0.0.0.0:7474-\>7474/tcp, :::7474-\>7474/tcp, 7473/tcp, 0.0.0.0:7687-\>7687/tcp, :::7687-\>7687/tcp neo4jdocker

I even have access to the web interface:

> curl [http://localhost:7474](http://localhost:7474)
> 
> {  
> "bolt\_routing" : "neo4j://localhost:7687",  
> "transaction" : "[http://localhost:7474/db/{databaseName}/tx](http://localhost:7474/db/%7BdatabaseName%7D/tx)",  
> "bolt\_direct" : "bolt://localhost:7687",  
> "neo4j\_version" : "5.15.0",  
> "neo4j\_edition" : "community"  
> }

And obviously the ports appear to be listened by the docker container:

> sudo lsof -i -P -n
> 
> COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME  
> docker-pr 2179741 root 4u IPv4 5668735 0t0 TCP \*:7687 (LISTEN)  
> docker-pr 2179747 root 4u IPv6 5667661 0t0 TCP \*:7687 (LISTEN)  
> docker-pr 2179759 root 4u IPv4 5670560 0t0 TCP \*:7474 (LISTEN)  
> docker-pr 2179766 root 4u IPv6 5669470 0t0 TCP \*:7474 (LISTEN)

And neo4j.log shows expected messages:

> 2023-12-27 15:30:10.305+0000 INFO Starting...  
> 2023-12-27 15:30:11.033+0000 INFO This instance is ServerId{57946358} (57946358-4700-4f22-bb6f-9bf3d5559522)  
> 2023-12-27 15:30:11.614+0000 INFO ======== Neo4j 5.15.0 ========  
> 2023-12-27 15:30:12.773+0000 INFO Bolt enabled on 0.0.0.0:7687.  
> 2023-12-27 15:30:13.346+0000 INFO HTTP enabled on 0.0.0.0:7474.  
> 2023-12-27 15:30:13.347+0000 INFO Remote interface available at [http://localhost:7474/](http://localhost:7474/)  
> 2023-12-27 15:30:13.349+0000 INFO id: 0101D8EABC7A7290033198E46D8969889C893917A0BC961C751565FB9B130D40  
> 2023-12-27 15:30:13.350+0000 INFO name: system  
> 2023-12-27 15:30:13.350+0000 INFO creationDate: 2023-12-22T22:57:40.961Z  
> 2023-12-27 15:30:13.350+0000 INFO Started.

So, at this point, my money is on a problem with the network configuration parameters. Can you please help me to identify what I did wrong? What is missing?

---

<div class="post-metadata">

**Author:** ![apoloduvalis](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/apoloduvalis/32/30377_2.png) [@apoloduvalis](https://community.neo4j.com/u/apoloduvalis)\
**Post date:** [December 28, 2023, 4:48pm UTC](https://community.neo4j.com/t/dockered-neo4j-community-error-trying-to-bind-to-public-ip-address/65523/2 "2023-12-28T16:48:42Z")

</div>

I just tried the default configuration, which I assumed would only work locally, and to my surprise it started responding to remote requests through the domain name.

```auto
    curl http://<server-domain>:7474
    
    {
      "bolt_routing" : "neo4j://<server-domain>:7687",
      "transaction" : "http://<server-domain>:7474/db/{databaseName}/tx",
      "bolt_direct" : "bolt://<server-domain>:7687",
      "neo4j_version" : "5.15.0",
      "neo4j_edition" : "community"
    }

```

So despite I did not set the specific server domain name nor the server's public IP address, Neo4j accepted connections through those.

Looking closer the Operation Manual documentation for the [server.default\_listen\_address setting](https://neo4j.com/docs/operations-manual/current/configuration/configuration-settings/#config_server.default_listen_address) it reads:

> To listen for connections on all interfaces, use "0.0.0.0".

So my interpretation is that changing the default value "localhost" to "0.0.0.0" in the configuration parameters was enough and all the other specific settings are redundant in this case:

```auto
    --env NEO4J_server_default __listen__ address=0.0.0.0 \

```
