# Connect to Neo4j in Docker from python in a different Docker container

**URL:** <https://community.neo4j.com/t/connect-to-neo4j-in-docker-from-python-in-a-different-docker-container/17641>\
**Category:** Operations\
**Created:** [April 26, 2020, 6:24pm UTC](https://community.neo4j.com/t/connect-to-neo4j-in-docker-from-python-in-a-different-docker-container/17641 "2020-04-26T18:24:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![david\_allen](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/david_allen/32/13090_2.png) [@david\_allen](https://community.neo4j.com/u/david_allen)\
**Post date:** [April 26, 2020, 11:08pm UTC](https://community.neo4j.com/t/connect-to-neo4j-in-docker-from-python-in-a-different-docker-container/17641/2 "2020-04-26T23:08:18Z")

</div>

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.

> **[Basic Networking with Docker](https://runnable.com/docker/basic-docker-networking)**
>
> The fundamentals of container networking with Docker.

---

_[View the full topic](https://community.neo4j.com/t/connect-to-neo4j-in-docker-from-python-in-a-different-docker-container/17641)._
