docker - Docker 使用 docker-compose 让服务在后台运行(树莓派 4 上 docker 容器中的 neo4j)
问题描述
我试图让 neo4j 在树莓派上的 Docker 容器中运行。
根据此处的说明,我已经设法让它在树莓派上本地运行
我可以让它在交互式 shell 中运行,但如果我尝试通过 docker-compose 运行,容器会立即退出。
即docker run -it -p 7474:7474 -p 7687:7687 neo4j.rpi.1:latest /bin/bash
这工作正常。
我大概需要某种在后台运行 neo4j 进程的方法 - 但我不知道如何
感谢您对此的任何帮助。
其他要点:
有一个官方的 docker-neo4j github 页面,但我无法在树莓派上构建它。
Dockerfile:
FROM balenalib/raspberry-pi-debian
RUN apt-get update
RUN apt-get install wget
RUN wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
RUN echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
RUN apt-get update
RUN apt-get install neo4j
COPY neo4j.conf /etc/neo4j/neo4j.conf
EXPOSE 7474 7473 7687
CMD ["neo4j", "start"]
docker-compose.yaml
version: '3'
services:
neo4j:
image: neo4j:rpi.1
ports:
- "7474:7474"
- "7687:7687"
volumes:
- ./neo4j/data:/data
- ./neo4j/logs:/NEO4J_dbms_logs_debug_level
- ./neo4j/import:/var/lib/neo4j/import
- ./neo4j/plugins:/plugins
environment:
NEO4J_AUTH: neo4j/test
entrypoint:
# - bin
# - bash
- neo4j
- start
错误信息:
Attaching to neo4j-rpi-docker_neo4j_1
compose.cli.verbose_proxy.proxy_callable: docker events <- (filters={'label': ['com.docker.compose.project=neo4j-rpi-docker', 'com.docker.compose.oneoff=False']}, decode=True)
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dneo4j-rpi-docker%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker events -> <docker.types.daemon.CancellableStream object at 0xb439eb30>
neo4j_1 | Active database: graph.db
neo4j_1 | Directories in use:
neo4j_1 | home: /var/lib/neo4j
neo4j_1 | config: /etc/neo4j
neo4j_1 | logs: /var/log/neo4j
neo4j_1 | plugins: /var/lib/neo4j/plugins
neo4j_1 | import: /var/lib/neo4j/import
neo4j_1 | data: /var/lib/neo4j/data
neo4j_1 | certificates: /var/lib/neo4j/certificates
neo4j_1 | run: /var/run/neo4j
neo4j_1 | Starting Neo4j.
neo4j_1 | Started neo4j (pid 47). It is available at http://0.0.0.0:7474/
neo4j_1 | There may be a short delay until the server is ready.
neo4j_1 | See /var/log/neo4j/neo4j.log for current status.
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('41fe8bd8dc4b84e56068fb9e274264333a6cc0c811f054a45fef0a98619eea1c')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('41fe8bd8dc4b84e56068fb9e274264333a6cc0c811f054a45fef0a98619eea1c')
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.25/containers/41fe8bd8dc4b84e56068fb9e274264333a6cc0c811f054a45fef0a98619eea1c/wait HTTP/1.1" 200 30
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 0}
neo4j-rpi-docker_neo4j_1 exited with code 0
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.25/containers/41fe8bd8dc4b84e56068fb9e274264333a6cc0c811f054a45fef0a98619eea1c/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
'Args': ['start'],
'Config': {'AttachStderr': False,
'AttachStdin': False,
'AttachStdout': False,
'Cmd': None,
'Domainname': '',
'Entrypoint': ['neo4j', 'start'],
'Env': ['NEO4J_AUTH=neo4j/test',
'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
解决方案
设法解决了,不得不在这里使用“docker-entrypoint.sh”文件,然后ENTRYPOINT ["/docker-entrypoint.sh"]
在我的Dockerfile
推荐阅读
- maven - 使用 Maven 和 Bitbucket 管道运行单个 JUnit 测试套件
- excel - 我正在尝试创建一个公式来从案例尺寸计算单位尺寸
- elasticsearch - 查询数据时别名切换
- java - Mockito、Java 9 和 java.lang.ClassNotFoundException:sun.reflect.ReflectionFactory
- strapi - Strapi:是否可以跟踪用户修改内容?
- javascript - 如何在提供的组件上实现这种依赖(react-native-pull-to-refresh),尤其是带有 fetchPopularMovies 的部分?
- swift4 - 在 Swift 4 中没有更多上下文属性文本的表达式类型不明确
- java - Android 上客户端凭据流的访问令牌
- node.js - 未找到模块:无法解析 pg/lib 中的“dns”
- java - 使用 Powermockito 模拟最终类的本地对象创建