Scenario
Requirement list REQ-03 (P1): the problem-side "network and mirror" domain is the #1 high-frequency domain (github-clone / docker-hub / pip·npm·go sources ≈ 20 entries), the inverse is the need — a fresh machine should have pip/npm/go/docker sources configured in one pass. This combo is a configuration solution, not a plugin: no new tools, just the four package managers' China mirror config commands + verification commands arranged as a set, each step copy-pasteable and verifiable. Aligned with the problem-side mirror entries (pip-mirror-source / npm-mirror-registry / go-proxy-cn / docker-hub-pull-fail).
Combo members
pip (Python package source): Tsinghua PyPI mirror
- Download: config written to
~/.config/pip/pip.conf(user-level, no root needed; official source https://pypi.org/simple is the default, nothing gets downloaded) - Version: pip >= 21 (old pip handles index-url consistently, no hard requirement)
- Install:
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip3 config set global.trusted-host pypi.tuna.tsinghua.edu.cn
# verify: read the currently effective config
pip3 config list
npm (Node package source): npmmirror mirror
- Download: config written to
~/.npmrc(user-level; official source https://registry.npmjs.org/ is the default) - Version: npm >= 7 (
npm config setbehaves consistently, no hard requirement) - Install:
npm config set registry https://registry.npmmirror.com
# verify: should output https://registry.npmmirror.com/
npm config get registry
Go (module proxy): goproxy.cn
- Download: config written to
~/.config/go/env(user-level,go env -wofficial mechanism; default proxy https://proxy.golang.org not directly reachable in China) - Version: Go >= 1.13 (module proxy mechanism default since 1.13)
- Install:
go env -w GOPROXY=https://goproxy.cn,direct
# verify: should output https://goproxy.cn,direct
go env GOPROXY
Docker (image acceleration): daemon.json registry-mirrors
- Download: config written to
/etc/docker/daemon.json(system-level, needs root; daemon restart after the change, affects running containers, optional step) - Version: Docker Engine >= 20.10 (registry-mirrors field long-supported)
- Install:
# back up an existing daemon.json before merging, don't overwrite original config
sudo cp /etc/docker/daemon.json /etc/docker/daemon.json.bak 2>/dev/null || true
sudo tee /etc/docker/daemon.json <<'EOF'
{
"registry-mirrors": ["https://docker.1ms.run", "https://docker.m.daocloud.io"]
}
EOF
sudo systemctl restart docker
# verify: outputs the mirror addresses in the config
docker info | grep -A 2 "Registry Mirrors"
Install order
- pip → npm → Go: the three user-level configs don't depend on each other, configure in "usage frequency" order; verify immediately after each step (
config list/config get/go env), a failure only affects that single step. - Docker last: system-level + daemon restart affects running containers, not mandatory (only enable when Docker Hub pulls fail; problem-side docker-hub-pull-fail is exactly this scenario).
- Coexisting with a proxy: mirrors still take effect when a proxy is on (package managers reach mirrors directly and faster); on campus-network/data environments the mirror is the main channel, the proxy is the fallback when mirrors fail — don't configure "proxy + mirror pointing at a blocked source" simultaneously.
Dependency warnings
- Conflicts: the four members have no shared write surfaces (pip.conf / .npmrc / go env / daemon.json don't overlap) → compatible; with an "already configured proxy" scenario: mirror and proxy can coexist, but npm/pip with a global proxy set will prefer the proxy, verification should use actual download speed tests (possible-compatible, constructive judgment).
- Versions: pip/npm/go/docker have no requirements beyond the hard version floors above; the docker step requires Docker Engine already installed.
- Environment: pip/npm/go are purely user-level (no root, no service restarts); the docker step needs root + daemon restart (affects running containers, back up daemon.json first).
- China network: none of this combo's commands download anything externally (config writes only), configuring sources costs zero traffic; verification recommends real small downloads (
pip3 download/npm view/go mod download) comparing mirror vs official source.
Acceptance check (one shot)
Run this block after configuring; all green = combo ready; any failure -> back to the matching step in the install walkthrough.
pip config list | grep -i index-url
npm config get registry
go env GOPROXY
docker info | grep -A4 'Registry Mirrors'
预期输出: tsinghua index-url; https://registry.npmmirror.com/; https://goproxy.cn,direct; Registry Mirrors shows the mirror addresses. All four green = mirrors configured
Note: member-level config commands all measured; restart the Docker daemon after editing daemon.json.
Verification evidence
Every combo is measured in an isolated environment (smoke + write-surface check); unmeasured items are honestly marked in the text, and measurement dates are listed in the verification section below.
Verified 2026-08-29 · TTL expires — (180 days)
Local verification record(2026-08-29)
- pip:
HOME=/tmp/mirror-test1 pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple→ wrote/tmp/mirror-test1/.config/pip/pip.conf;config listread backglobal.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'✓ - npm:
HOME=/tmp/mirror-test2 npm config set registry https://registry.npmmirror.com→npm config get registryoutputhttps://registry.npmmirror.com/✓ - go:
HOME=/tmp/mirror-test3 go env -w GOPROXY=https://goproxy.cn,direct→go env GOPROXYoutputhttps://goproxy.cn,direct✓ - docker: not measured — daemon.json needs root + daemon restart, touches the user environment, red line not touched; the config snippet and verification command are given, to be measured when an isolated Docker environment is available
Related problems
← All combos | Tool Catalog | Hit a problem? Submit a helpdesk card