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 Pro (Docker requirement)
  • Architecture: x86_64
  • At least 4GB 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 -H "Content-Type:application/json" --data-binary @- "http://localhost:8080/document/v1/music/music/docid/1"
    $ cat %VESPA_SAMPLE_APPS%/basic-search/music-data-2.json | curl -s -H "Content-Type:application/json" --data-binary @- "http://localhost:8080/document/v1/music/music/docid/2"
    
  7. Run a query post or get request :
    $ curl -s -H "Content-Type: application/json" --data '{"query" : "bad"}' http://localhost:8080/search/ | python -m json.tool
    
    $ curl -s http://localhost:8080/search/?query=bad | python -m json.tool
    
    View the results in a browser in the GUI for building queries at http://localhost:8080/querybuilder/, which can help you building queries with e.g. autocompletion of YQL, or at http://localhost:8080/search/?query=bad. Read more in the Search API.
  8. Run a document get request:
    $ curl -s http://localhost:8080/document/v1/music/music/docid/2 | python -m json.tool
    
  9. 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
    

Troubleshooting

If you encounter any problems see troubleshooting.

Next Steps