You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker部署Hyperledger Sawtooth后测试XO交易连接失败求助

Hyperledger Sawtooth XO Transaction: Connection Refused to 127.0.0.1:8008 in Docker

Looks like you're hitting a common Docker networking snag here. When you run xo create one inside the sawtooth-shell-default container, it’s trying to connect to 127.0.0.1:8008—but that points to the localhost of the shell container itself, not your host machine or the Sawtooth REST API container where the service actually runs.

Why This Happens

Each Docker container has its own isolated network namespace. The Sawtooth REST API runs in a separate container (usually named sawtooth-rest-api-default), so the shell container can’t reach it via 127.0.0.1. Docker’s internal DNS resolves container names to their respective IPs within the shared network, so we need to use that instead.

Step-by-Step Fix

Here’s how to get your XO transaction working:

  1. Verify the REST API container is running
    From your host machine, list active containers to confirm the REST API container is up:

    docker ps
    

    You should see sawtooth-rest-api-default in the output. If not, start it with:

    docker start sawtooth-rest-api-default
    
  2. Update the REST API URL in the shell container
    Once you’re inside sawtooth-shell-default, set the SAWTOOTH_REST_API_URL environment variable to point to the REST API container’s name:

    export SAWTOOTH_REST_API_URL=http://sawtooth-rest-api-default:8008
    
  3. Retry the XO transaction
    Now run your command again:

    xo create one
    

    This should successfully connect to the REST API and submit your transaction.

Extra Checks

  • Ensure all Sawtooth containers are on the same Docker network. By default, they use sawtooth_default. Verify this with:
    docker network inspect sawtooth_default
    
    Check that both sawtooth-shell-default and sawtooth-rest-api-default are listed under the "Containers" section.

内容的提问来源于stack exchange,提问作者XYZVoyager

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:11:06