irr*_*rom 5 docker singularity-container
我是 Docker 和 Singularity 的新手。我最近创建了规范的main.c.
#include <stdio.h>
#include <stdlib.h>
int main(void){
printf("Hello Docker World!\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我静态编译了这段代码,即
gcc -static -static-libgcc -static-libstdc++ -o hello main.c
Run Code Online (Sandbox Code Playgroud)
然后我构建了docker镜像并可以运行它,即
dockerd & ## Start Docker daemon
docker build --tag hello .
docker run hello ## Outputs "Hello Docker World"
Run Code Online (Sandbox Code Playgroud)
然后我保存图像,以便我可以将其导出到第二台计算机(它没有 docker,但确实有奇点),即
docker save hello > hello.tar
Run Code Online (Sandbox Code Playgroud)
现在在第二台没有 docker 但有奇点的机器上,我想创建一个奇点图像。奇点文档给出了从 Docker Hub 上的 docker 镜像创建奇点镜像的说明,但没有给出从 docker tar 文件转换的说明。
问题:我将如何从我的图像中创建一个奇点图像 hello.tar
使用本地注册表容器如下:
# Start a docker registry
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
# Push local docker container to it
$ docker tag alpine localhost:5000/alpine
$ docker push localhost:5000/alpine
# Create def file for singularity like this..
# (add your modifications)
Bootstrap: docker
Registry: http://localhost:5000
Namespace:
From: alpine:latest
# Build singularity container
$ sudo SINGULARITY_NOHTTPS=1 singularity build alpine.simg def
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2343 次 |
| 最近记录: |