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.
++ ./ -t 120 localhost:8080 -- ./ waiting 120 seconds for localhost:8080 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'

Leave a Reply

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