1. 启动alpine容器
#以管理员权限创建容器
docker run -itd --privileged --name="alpine" alpine
#创建docker执行别名
alias apline='docker exec -it alpine sh'
#登录alpine容器
alpine
2. 修改源
在文件/etc/apk/repositories中修改源:
http://mirrors.aliyun.com/alpine/v3.8/main/
http://mirrors.aliyun.com/alpine/v3.8/community/
#官方CDN源
https://dl-cdn.alpinelinux.org/alpine/edge/main
https://dl-cdn.alpinelinux.org/alpine/edge/community
http://dl-cdn.alpinelinux.org/alpine/edge/testing
#阿里镜像 https://mirrors.aliyun.com
#sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#更换为科大镜像 http://mirrors.ustc.edu.cn
#sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
然后更新源
apk update
3.安装iproute2
apk add iproute2
本文最新状态可查看源站链接:Alpine容器添加netns功能支持