-
Notifications
You must be signed in to change notification settings - Fork 34
Cargo network issue when work with Docker
LinFeng Qian edited this page Jun 15, 2021
·
2 revisions
Start the capsule docker container use below command:
DOCKER_IMAGE=jjy0/ckb-capsule-recipe-rust:2020-9-28
docker run --rm -it \
-eUID=`id -u` -eGID=`id -g` -eUSER=`id -un`\
-v capsule-cache:/root/.cargo \
-v `pwd`:/code \
-w/code ${DOCKER_IMAGE} bash
Update ~/.cargo/config
in docker with follow content (for Chinese user):
cat > ~/.cargo/config << EOF
[source.crates-io]
replace-with = 'sjtu'
# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
# 中国科学技术大学
[source.ustc]
registry = "https://mirrors.ustc.edu.cn/crates.io-index"
# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
# rustcc社区
[source.rustcc]
registry = "git://crates.rustcc.cn/crates.io-index"
EOF
Since we use docker's volume mount feature, the changes will be persisted.