1.创建帐号密码文件,并添加内容

touch /opt/pyserver/.htpasswd
echo "username:password" > /opt/pyserver/.htpasswd

2.创建包路径

mkdir /opt/pyserver/packages

3.创建私有仓库

# 不带转发的命令
docker run --name pypi --restart always -v /opt/pyserver/packages:/data/packages -v /opt/pyserver/.htpasswd:/data/.htpasswd -p 8080:8080 -d pypiserver/pypiserver -P . -a . packages

# 带转发地址的命令
docker run --name pypi --restart always -v /opt/pyserver/packages:/data/packages -v /opt/pyserver/.htpasswd:/data/.htpasswd -p 8080:8080 -d pypiserver/pypiserver -P . -a . packages --fallback-url https://pypi.doubanio.com/simple