Issue
I'm trying to get neo4j running inside a Docker container on raspberry pi.
I've managed to get it running natively on raspberry pi based on instructions here
I can get it to run in an interactive shell, but if I try to run through docker-compose the container exits immediately.
i.e. docker run -it -p 7474:7474 -p 7687:7687 neo4j.rpi.1:latest /bin/bash
this works ok.
I presumably need some way of running the neo4j process in the background - but I can't work out how to
Grateful for any help with this.
Other points:
I'm using a balenalib image as the base
There's an official docker-neo4j github page, but I can't get this to build on raspberry pi.
The
neo4j.conf
file that I'm copying over is the default file with remote access enabled
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
error message:
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',
...
Solution
Managed to work it out, had to use the "docker-entrypoint.sh" file here and then have ENTRYPOINT ["/docker-entrypoint.sh"]
in my Dockerfile
Answered By - ceharep