This isn't related to Neo4j, it's just how docker networking works. To fix this, you have to create a network and assign both of your containers to it, otherwise the containers can each talk to the host, but not to each other. This explains why it works from your host machine but not from the second docker container.
Here are the docker networking docs that will step you through how to do that.