SciPy是一个功能强大的python库,但是它具有许多依赖关系,包括Fortran。 因此,在Docker容器中运行Scipy代码绝对有道理。 我们将使用私有注册表:
docker run -d -p 5000:5000 --name registry registry:2
我将使用Centos图像。 Centos是非常流行的基于RedHat的Linux发行版,RedHat是商业Linux发行版。 Oracle的Linux和Amazon Linux基于Red Hat Linux。
docker pull centos
docker tag centos localhost:5000/centos
docker push localhost:5000/centos
然后我们开始一个容器
docker run -i -t --name centoscontainer localhost:5000/centos /bin/bash
我们安装所有二进制依赖项
yum install -y epel-release
yum -y update
yum -y groupinstall "Development Tools"
yum -y install python-devel
yum -y install blas --enablerepo=epel
yum -y install lapack --enablerepo=epel
yum -y install Cython --enablerepo=epel
yum -y install python-pip
然后我们安装scipy堆栈
pip install boto3
pip install numpy
pip install pandas
pip install scipy
我们已经准备好了。 现在,我们应该继续提交映像。
docker commit -m 'Added scipy stack' -a "Emmanouil Gkatziouras" 4954f603d93b localhost:5000/scipy
docker push localhost:5000/scipy
现在我们可以运行启用了SciPy的容器了。
docker run -t -i localhost:5000/scipy /bin/bash
最后但并非最不重要的一点是,我们清除了注册表。
docker stop registry && docker rm -v registry
翻译自: https://www.javacodegeeks.com/2016/03/implement-scipy-stack-docker-image.html