在GCE中使用RexRay驱动创建Docker卷失败
Hey there, let's tackle that frustrating error you're hitting when trying to create a RexRay-backed GCEPD volume with Docker. I've worked through similar headaches with GCE and RexRay, so here are the actionable steps to get this sorted:
1. Double-Check RexRay Plugin Configuration
First up, make sure your RexRay plugin has the correct GCE-specific settings. Even if you installed it via the managed plugin, the default config often misses critical details like your project ID or zone.
- Run this command to inspect the plugin's current settings:
Look for environment variables likedocker plugin inspect rexray/gcepdGCE_PROJECTandGCE_ZONE—they need to match your GCE instance's actual project ID and zone (e.g.,my-gcp-projectandus-central1-a). - If they're wrong or missing, reconfigure the plugin with:
docker plugin disable rexray/gcepd -f docker plugin set rexray/gcepd GCE_PROJECT=<your-project-id> GCE_ZONE=<your-instance-zone> docker plugin enable rexray/gcepd
2. Validate Service Account Permissions
Even though you mentioned the service account has Project Editor access, let's confirm it has the specific permissions RexRay needs to interact with GCE disks:
compute.disks.createcompute.disks.deletecompute.disks.getcompute.disks.listcompute.zones.get
Project Editor should include these, but sometimes custom IAM roles or organization-wide restrictions can block access. As a quick test, temporarily assign the Compute Admin role to the instance's service account—if the volume creation works, you know it's a permission issue that needs refining.
3. Check Docker-RexRay Compatibility
Your Docker version (18.03.1-ce) is a bit outdated, and RexRay 0.8 (from the tutorial) can have compatibility quirks with older (or newer) Docker releases. Try one of these:
- Update Docker to a recent stable version (like 20.10.x) since 18.03 is end-of-life and no longer supported.
- Stick strictly to the RexRay 0.8 version from the tutorial: when reinstalling, use
rexray/gcepd:0.8instead of the latest tag, as newer RexRay versions changed how they handle GCEPD.
4. Verify GCE Disk Existence
The error mentions "querying for existing volume"—RexRay might be struggling to check if a disk named storage1 already exists.
- Head to your GCE Console, go to Disks, and search for
storage1. If it exists (even if it's unused), delete it and try creating the volume again. - Note that GCE disk names are case-sensitive and must be lowercase—make sure your volume name
storage1follows this rule.
5. Enable Debug Logs for RexRay
To get to the root of the query failure, turn on debug logging for the RexRay plugin:
docker plugin disable rexray/gcepd -f docker plugin set rexray/gcepd REXRAY_LOGLEVEL=debug docker plugin enable rexray/gcepd
Then retry the volume creation command, and check the logs with:
docker plugin logs rexray/gcepd
The logs will show exactly where the query is failing—whether it's an authentication issue, zone mismatch, or something else entirely.
6. Reinstall the RexRay Plugin
Sometimes plugin installations get corrupted. Try removing and reinstalling it cleanly:
docker plugin rm rexray/gcepd -f docker plugin install rexray/gcepd:0.8 --grant-all-permissions
After reinstalling, reconfigure the project and zone as we did in step 1.
In my experience, this error usually boils down to misconfigured zone/project settings or subtle permission issues that aren't obvious with Project Editor access. Start with steps 1 and 4—they're the quickest to validate and fix most cases.
内容的提问来源于stack exchange,提问作者Avinash

