conda与docker踩坑记录
业务背景:需要创建一个conda的docker容器,在容器中创建环境并安装相应的包。之前在使用conda时,使用的代理为默认的default,没有遇到网络相关的问题。最近在使用Dockerfile构建有conda环境的容器时,遇到两个问题。
1.在conda create时,遇到SSL:WRONG_VERSION_NUMBER _ssl.c:1000。
2.在使用Dockerfile构建容器时,遇到NameResolutionError。
1.SSL:WRONG_VERSION_NUMBER _ssl.c:1000问题总结
问题产生场景: 在使用Dockerfile构建容器时,conda create命令与conda install命令在执行时,遇到SSL版本错误问题。
解决方法:
1.尝试更新SSL版本(无用)
2.核查主机上所有代理(无用,主机上之前没配置过任何代理)
3.更新conda的镜像源(有用)
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
2.使用Dockerfile构建容器时遇到NameResolutionError问题
问题产生场景: 在使用Dockerfile构建容器时,处理完SSL:WRONG VERSION NUMBER问题后,报错。
解决办法:
执行docker的重启命令。
sudo service docker restart