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/album-recommendation-selfhosted/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%/album-recommendation-selfhosted/src/test/resources/A-Head-Full-of-Dreams.json | curl -s -H "Content-Type:application/json" --data-binary @- "http://localhost:8080/document/v1/mynamespace/music/docid/1"
    $ cat %VESPA_SAMPLE_APPS%/album-recommendation-selfhosted/src/test/resources/Love-Is-Here-To-Stay.json | curl -s -H "Content-Type:application/json" --data-binary @- "http://localhost:8080/document/v1/mynamespace/music/docid/2"
    $ cat %VESPA_SAMPLE_APPS%/album-recommendation-selfhosted/src/test/resources/Hardwired...To-Self-Destruct.json | curl -s -H "Content-Type:application/json" --data-binary @- "http://localhost:8080/document/v1/mynamespace/music/docid/3"
    
  7. Make a query:
    $ curl -s "http://localhost:8080/search/?ranking=rank_albums&yql=select%20%2A%20from%20sources%20%2A%20where%20sddocname%20contains%20%22music%22%3B&ranking.features.query(user_profile)=%7B%7Bcat%3Apop%7D%3A0.8%2C%7Bcat%3Arock%7D%3A0.2%2C%7Bcat%3Ajazz%7D%3A0.1%7D"
    

    View query results in a browser with the query builder UI at http://localhost:8080/querybuilder/, or have a look at raw query results at http://localhost:8080/search/?query=artist:metallica. The query builder has guided queries and YQL autocompletion. Read more in the query API.

  8. Run a document get request:
    $ curl -s http://localhost:8080/document/v1/mynamespace/music/docid/2
    
  9. Clean up:

    $ docker rm -f vespa
    

Troubleshooting

If you encounter any problems see troubleshooting.

Next Steps