neo4j / docker-neo4j

Docker Images for the Neo4j Graph Database
Apache License 2.0
320 stars 168 forks source link

VSCode can't start a stopped devcontainer #419

Closed masavini closed 1 year ago

masavini commented 1 year ago

Hi, inside my docker-compose.yml I'm using this neo4j service:

  neo4j:
    environment:
      - NEO4J_AUTH=none
    image: "neo4j:5.3.0"
    logging:
      options:
        max-size: "10m"
        max-file: "1"
    ports:
      - "${NEO4J_HTTP_PORT}:7474"
      - "${NEO4J_BOLT_PORT}:7687"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - "/data/${APP_NAME}/neo4j/data:/data"
      - "/data/${APP_NAME}/neo4j/logs:/logs"

Everything seems to work fine but if I run docker-compose stop and then docker-compose start, neo4j container won't start.

docker logs shows this:

023-01-10 22:31:50.540+0000 INFO  Starting...
2023-01-10 22:31:51.277+0000 INFO  This instance is ServerId{ecf624d3} (ecf624d3-5a79-4ecb-97df-bb9263d0c1fd)
2023-01-10 22:31:52.962+0000 INFO  ======== Neo4j 5.3.0 ========
2023-01-10 22:31:55.385+0000 INFO  Bolt enabled on 0.0.0.0:7687.
2023-01-10 22:31:56.679+0000 INFO  Remote interface available at http://localhost:7474/
2023-01-10 22:31:56.681+0000 INFO  id: C4BCBFC3A480D530C9BBD6D4602D29AF47449259F850BBE2A7AB1126E81C11FB
2023-01-10 22:31:56.681+0000 INFO  name: system
2023-01-10 22:31:56.681+0000 INFO  creationDate: 2023-01-04T23:13:14.846Z
2023-01-10 22:31:56.681+0000 INFO  Started.
2023-01-10 23:56:11.362+0000 INFO  Neo4j Server shutdown initiated by request
2023-01-10 23:56:11.366+0000 INFO  Stopping...
Neo4j is already running (pid:7).
Run with '--verbose' for a more detailed error message.

To manage and start the container again I have to recreate it, then everything will work until the next stop. Any help would be appreciated, thanks.

masavini commented 1 year ago

Closing: it looks like this is related to VSCode stopping the container uncleanly...

masavini commented 1 year ago

If your facing the same issue with VSCode not properly stopping the container, you can add something like this to your docker-compose file:

neo4j:
    # avoid exit code 137 issue when closing vscode
    entrypoint: /bin/sh -c 'rm -f /var/lib/neo4j/run/neo4j.pid; /startup/docker-entrypoint.sh neo4j'