DevOps
Implement a SciPy Stack Docker Image
SciPy is a powerful python library, but it has many dependencies including Fortran. So Running your Scipy code in a docker container makes absolute sense. We will use a private registry:
1 | docker run -d -p 5000:5000 --name registry registry:2 |
I will use a Centos image. Centos is a very popular linux distribution based on RedHat which is a commercial Linux distribution. Oracle’s Linux and Amazon Linux is based on Red Hat Linux.
1 2 3 | docker pull centos docker tag centos localhost:5000 /centos docker push localhost:5000 /centos |
Then we start a container
1 | docker run -i -t --name centoscontainer localhost:5000 /centos /bin/bash |
We install all binary dependencies
1 2 3 4 5 6 7 8 | 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 |
Then we install the scipy stack
1 2 3 4 | pip install boto3 pip install numpy pip install pandas pip install scipy |
And we are ready. Now we should proceed on committing the image.
1 2 | docker commit -m 'Added scipy stack' -a "Emmanouil Gkatziouras" 4954f603d93b localhost:5000 /scipy docker push localhost:5000 /scipy |
Now we are ok to run our SciPy enabled container.
1 | docker run -t -i localhost:5000 /scipy /bin/bash |
Last but not least we clear our registry.
1 | docker stop registry && docker rm - v registry |
Reference: | Implement a SciPy Stack Docker Image from our JCG partner Emmanouil Gkatziouras at the gkatzioura blog. |