Docker Community Forums

Share and learn in the Docker community.

Persist Changes to New Image - neo4j

docker

(Jquisenberry) #1

I am trying to create a new image based on the neo4j:latest image. What is the proper way to persist to a new image and run a container based on the image?

I have these goals:

  • Save the new password I assigned to the database.
  • Keep data stored in the database.

I am using
Windows 10
Docker Community Edition Version 18.06.0-ce-win72 (19098)

Here is what I have tried:

  1. Start a container from neo4j:latest.

I used this docker-compose.yml:

version: "3"
services:
  neo4j:
    image: neo4j:latest
    ports:
      - "7474:7474"
      - "7687:7687"    
networks:
  webnet:
  1. Connect to neo4j using a browser. I set a new password, as is required.

http://localhost:7474/browser/

  1. Load data into the database using a script run on my host. I verified that the database now contains nodes and relationships.

  2. Commit the container to an image.

docker commit --author="Jacob Quisenberry" c5c3f2998895 jquisenberry/graphdb:latest

  1. Push the image to my repository.

docker push jquisenberry/graphdb:latest

  1. Run the image

docker run --expose=7474 --expose=7687 -p 7474:7474 -p 7687:7687 jquisenberry/graphdb:latest

  1. Connect using a browser.

I expected not to have to enter a new password and for my data to be intact.Instead, I am required to enter a new password. My database lacks nodes and relationships.