简体   繁体   English

如何从 dockerfile 构建奇异容器

[英]how to build singularity container from dockerfile

I want to build singularity container from dockerfile.我想从 dockerfile 构建奇异容器。

I have pulled and run docker images from docker hub with singularity.我已经从 docker hub 中提取并运行了 docker 镜像。

singularity pull docker://ubuntu:latest

I have also build the image from singularity recipe file.我还从奇点配方文件中构建了图像。

singularity build  cpp.sif singularity_file

But I want to build singularity image from dockerfile.但我想从 dockerfile 构建奇异图像。

Anyone know how to do it.任何人都知道该怎么做。 Is it possible ???是否可以 ???

You cannot build a singularity container directly from a Dockerfile, but you can do it in a two-step process.您不能直接从 Dockerfile 构建奇点容器,但可以分两步完成。

docker build -t local/my_container .
sudo singularity build my_container.sif docker-daemon://local/my_container

Using docker://my_container look for the container on Docker Hub.使用docker://my_container在 Docker Hub 上查找容器。 When you use docker-daemon , it looks at your locally built docker containers.当您使用docker-daemon ,它会查看您本地构建的 docker 容器。 You can also use Bootstrap: docker-daemon in a Singularity definition file.您还可以在 Singularity 定义文件中使用Bootstrap: docker-daemon

You can transform a Dockerfile into a singularity recipe or vise-versa using Singularity Python.您可以使用 Singularity Python 将 Dockerfile 转换为奇点配方,反之亦然。 Singularity Python offers some very helpful utilities, consider to install it if you plan to work with singularity a lot Singularity Python 提供了一些非常有用的实用程序,如果您打算大量使用奇点,请考虑安装它

pip3 install spython # if you do not have spython install it from the command line

# print in the console
spython recipe Dockerfile

# save in the *.def file
spython recipe Dockerfile &> Singularity.def

If you have problems with pip you can download spython or pull a container as described in Singularity Python install .如果您遇到 pip 问题,您可以下载 spython 或拉取容器,如Singularity Python install 中所述 Find more about recipe conversion here在此处查找有关配方转换的更多信息

sudo singularity build ubuntu.sif docker://ubuntu:latest

builds it directly for me直接为我构建

Unsure if there was an update to singularity for this purpose不确定是否为此目的更新了奇点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM