Fixing Vespa error: curl: (7) Failed to connect to ::1: Cannot assign requested address

If you try to script starting up Vespa, you can get an error like this:

++ set -e
+++ docker ps --filter name=findlectures_vespa -q
++ CID=
++ '[' '!' -z ']'
+++ pwd
++ docker run -m 10G --detach --name findlectures_vespa --hostname findlectures --rm --privileged --volume /projects/findlectures-vespa/app:/app --publish 8080:8080 --publish 19112:19112 vespaengine/vespa
WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
6fec2e4219294fe18fd5a8f5cf2390339b209f76f293ec3bb854129b3f578550
++ ./wait-for-it.sh -t 120 localhost:8080 -- ./load.sh
wait-for-it.sh: waiting 120 seconds for localhost:8080
wait-for-it.sh: localhost:8080 is available after 0 seconds
++ set -e
++ docker exec findlectures_vespa bash -c '/opt/vespa/bin/vespa-deploy prepare /app/application && \
    /opt/vespa/bin/vespa-deploy activate'
Uploading application '/app/application' using http://localhost:19071/application/v2/tenant/default/session?name=application
curl: (7) Failed to connect to ::1: Cannot assign requested address
HTTP request failed. Could not connect to http://localhost:19071

This indicates that you’ve tried running commands against Vespa before it’s ready. You can fix this by polling for it to start:

until docker exec findlectures_vespa bash -c 'curl -s --head http://localhost:19071/ApplicationStatus'
do
  :
done


Need help with Solr or Elastic Search? Contact me for Solr consulting.

Leave a Reply

Your email address will not be published. Required fields are marked *