Vespa quick start using Docker

This guide describes how to install and run Vespa on a single machine using Docker on Microsoft Windows 10.

Prerequisites:

  • Docker installed.
  • Cmder full version installed.
  • Operating system: Microsoft Windows 10
  • Architecture: x86_64
  • At least 2GB of memory dedicated to your container instance.

All the steps below should be executed in a cmder console window.
  1. Clone the Vespa sample apps from github:
    $ git clone https://github.com/vespa-engine/sample-apps.git
    $ set VESPA_SAMPLE_APPS="%CD%\sample-apps"
    
  2. Start a Vespa Docker container:
    $ docker run --detach --name vespa --hostname vespa-container --privileged --volume %VESPA_SAMPLE_APPS%:/vespa-sample-apps --publish 8080:8080 vespaengine/vespa
    
  3. Wait for configuration server to start - wait for a 200 OK response:
    $ docker exec vespa bash -c "curl -s --head http://localhost:19071/ApplicationStatus"
    
  4. Deploy and activate a sample application:
    $ docker exec vespa bash -c "/opt/vespa/bin/vespa-deploy prepare /vespa-sample-apps/basic-search/src/main/application"
    $ docker exec vespa bash -c "/opt/vespa/bin/vespa-deploy activate"
    
  5. Ensure the application is active - wait for a 200 OK response:
    $ curl -s --head "http://localhost:8080/ApplicationStatus"
    
  6. Feed documents:
    $ cat %VESPA_SAMPLE_APPS%/basic-search/music-data-1.json | curl -s -X POST --data-binary @- "http://localhost:8080/document/v1/music/music/docid/1"
    $ cat %VESPA_SAMPLE_APPS%/basic-search/music-data-2.json | curl -s -X POST --data-binary @- "http://localhost:8080/document/v1/music/music/docid/2"
    
  7. Run a query and a document get request :
    $ curl -s "http://localhost:8080/search/?query=bad"
    
    $ curl -s "http://localhost:8080/document/v1/music/music/docid/2"
    
    View the results in a browser at http://localhost:8080/search/?query=bad. Read more in the Search API.
  8. Clean up when you're done

    Stop the running container when you no longer need it:

    $ docker stop vespa
    

    Optionally, remove the stopped container entirely:

    $ docker rm vespa