我目前正在研究奇点和docker。我正在为MPI环境运行奇点。
我想为MPI使用奇点的优点,但是奇点文件非常大。因此,在运行奇点图像后,我想将其转换为docker图像,然后保存它,这将节省磁盘空间。
这有可能将奇点图像转换为docker图像吗?
发布于 2020-03-01 05:16:57
使用Singularity将MPI应用程序容器化并不是非常困难,但这是以主机系统的额外需求为代价的。
这意味着您必须为此自定义图像选择正确的图像基础。类似于this example:
FROM tacc/tacc-ubuntu18-mvapich2.3-psm2:0.0.2
RUN apt-get update && apt-get upgrade -y && apt-get install -y python3-pip
RUN pip3 install mpi4py
COPY pi-mpi.py /code/pi-mpi.py
RUN chmod +x /code/pi-mpi.py
ENV PATH "/code:$PATH"发布于 2020-03-02 19:30:11
一般来说,它是在另一个方向上完成的:基于Docker构建奇点映像。如果您计划将其存储为docker映像而不是奇点,则最好的方法是将其构建为Docker并根据需要转换为奇点。我知道有几个实验室使用这种方法:通过Dockerfile构建,推送到Docker hub进行存储,直接从docker hub镜像构建奇点镜像。
然而,奇点图像通常比docker图像小。在另一个答案中提到的基本docker镜像tacc/tacc-ubuntu18-mvapich2.3-psm2:0.0.2是497MB,但奇点镜像只有160MB。ubuntu:latest为64.2MB vs 25MB,python:latest为933MB vs 303MB。
发布于 2020-03-03 09:25:33
正如@tsnowlan在他们的回答中所说的那样,典型的工作流程是从Docker到Singularity。但是有一种方法可以从现有的奇点镜像中创建Docker镜像。这将不会使用Docker的层缓存功能。
一般的想法是:
这是bash中的代码,在alpine:latest上演示
singularity pull docker://alpine:latest
# Find out which SIF ID to use (look for Squashfs)
singularity sif list alpine_latest.sif
# Get the environment variables defined in the Singularity image.
singularity sif dump 2 alpine_latest.sif
singularity sif dump 3 alpine_latest.sif > data.squash
unsquashfs -dest data data.squash
# See the Dockerfile definition below
docker build --tag alpine:latest .Dockerfile的内容:
FROM scratch
COPY data /
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CMD ["/bin/ash"]有关奇点和Docker的更多信息,我建议查看Singularity's documentation on the topic。
https://stackoverflow.com/questions/60451712
复制相似问题