Docker 和 Neo4J

标签 docker neo4j dockerfile

我正在尝试在 Docker 容器中启动并运行 Neo4J 数据库。 目前我使用以下命令运行它:

docker run -d -p 7474:7474 -p 7687:7687 neo4j

..并且工作正常。

我想将其放入 Dockerfile 中,以便我可以进行一些服务器配置,但是当我使用 Dockerfile 时,它​​不会公开我设置为公开的端口,除非我在执行“docker run”时明确公开它们“:

FROM neo4j
ENV NEO4J_AUTH neo4j/password
EXPOSE 7474:7474
EXPOSE 7687:7687

我是否误解了什么,或者端口不应该通过此配置自动公开?

最佳答案

The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. EXPOSE does not make the ports of the container accessible to the host. To do that, you must use either the -p flag to publish a range of ports or the -P flag to publish all of the exposed ports. You can expose one port number and publish it externally under another number.

To set up port redirection on the host system, see using the -P flag. The Docker network feature supports creating networks without the need to expose ports within the network, for detailed information see the overview of this feature).

https://docs.docker.com/engine/reference/builder/

关于Docker 和 Neo4J,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43173446/

相关文章:

mongodb - 如何使用默认集合和数据创建 Mongo Docker 镜像?

ruby - 在当前文件夹上使用Ruby REPL的Docker

带有本地服务器的 Docker/Kubernetes

python - 如何用 Python 为 neo4j 定义遍历?

docker - 启动运行docker镜像时如何设置运行bash文件

angular - Docker Angular 容器-热装

php - Docker PHP容器抛出20 0's and 404'

java - Neo4j 使用自定义评估器获取检索节点的深度

neo4j - 连接到同一网络上不同计算机上的 neo4j?

docker - 您可以控制Dockerfile中的Docker运行参数吗