如何解决Docker部署中GridGain Web Agent无法连接控制台的问题
Fixing GridGain Web Agent Connection Issues with Docker Compose
Looking at your error logs and configuration, the main issues are with how you're pointing the Web Agent to the GridGain Console backend, and missing the required WebSocket protocol scheme. Let's break down the fixes:
Key Error Breakdown
The critical lines in your log tell the story:
java.lang.IllegalArgumentException: URI scheme must be 'ws' or 'wss'
Connecting to server: frontend:80
- You're missing the WebSocket protocol prefix (
ws:///wss://) in yourSERVER_URI - The Web Agent should connect directly to the backend service, not the frontend (the frontend is just a static file proxy, not the WebSocket endpoint)
Corrected Docker Compose Configuration
Here's the updated docker-compose.yml with fixes applied:
version: '2.4' services: backend: image: gridgain/gridgain-web-console-backend:2020.05.00 restart: always environment: # Uncomment and configure if you need email notifications #- SPRING_MAIL_HOST= #- SPRING_MAIL_PORT= #- SPRING_MAIL_USERNAME= #- SPRING_MAIL_PASSWORD= - JVM_OPTS= volumes: - ${PWD}/Users:/opt/gridgain-web-console-server/work frontend: depends_on: - backend image: gridgain/gridgain-web-console-frontend:2020.05.00 ports: - 80:8008 container_name: frontend webagent: depends_on: - backend image: gridgain/gridgain-web-agent:2020.05.00 environment: # Ensure this token matches the one generated in your GridGain Web Console - TOKENS=59f9d111-eaad-405b-a3c8-310e9245f943 # Use ws:// protocol + backend service name + default WebSocket port (8080) - SERVER_URI=ws://backend:8080
What Changed & Why
- Fixed
SERVER_URI: Added thews://protocol prefix and pointed directly to thebackendservice (the GridGain backend listens for Web Agent connections on port 8080 by default). - Simplified dependencies: The Web Agent only needs to wait for the backend to start, not the frontend, since it doesn't communicate with the frontend service at all.
- Verified token: Double-check that your
TOKENSvalue matches the valid agent token you generated in the GridGain Web Console UI (invalid tokens will also cause connection failures).
Post-Fix Validation
After updating the config, run docker-compose down && docker-compose up and check the logs:
- Confirm the backend starts successfully and logs that it's listening on port 8080
- Check the webagent logs for a message like
Successfully established websocket connection with server
内容的提问来源于stack exchange,提问作者Martin
相关产品推荐
相关产品推荐

