skip to Main Content

I spin up weaviate using the docker image and then created two classes and added around 400+ data entries for these classes using a Java client. I also tried the Q&A module for querying the data and it was working ok.

As soon as I restarted the Weaviate instance in the Docker container, my schema was lost.

I am completely new to Weaviate and not sure what went wrong.

2

Answers


  1. That’s because the Weaviate volume sits inside your container. Mounting a container will solve your problem. In the example below, change /var/weaviate to any folder you like).

    For example:

    ---
    version: '3.4'
    services:
      weaviate:
        command:
        - --host
        - 0.0.0.0
        - --port
        - '8080'
        - --scheme
        - http
        image: semitechnologies/weaviate:1.8.0
        ports:
        - 8080:8080
        restart: on-failure:0
        volumes:
          - /var/weaviate:/var/lib/weaviate # <== set a volume here
        environment:
          QUERY_DEFAULTS_LIMIT: 25
          AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
          PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
          DEFAULT_VECTORIZER_MODULE: 'none'
          ENABLE_MODULES: ''
          CLUSTER_HOSTNAME: 'node1' # <== this can be set to an arbitrary name
    ...
    
    Login or Signup to reply.
  2. Docker itself is all temporary by default, That’s part of the point of docker low footprint low clean up.

    You can use volumes to create and map to a volume that is a shared folder with the host machine that will stay and remount between instances of the container.

    Full documentation is here.

    https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference

    TLDR;

    A volumes, section to the compose file. That would look something like this:

    services:
      weaviate:
        image: waviate
        volumes:
          - localFolder:/var/lib/weaviate/data
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search