1.建立本地docker鏡像倉庫
①下載registry鏡像
# docker pull registry
②配置http權限支持
# vim /etc/docker/daemon.json
{
"insecure-registries": ["192.168.1.55:5000"]
}
注:192.168.1.55是你的本機ip
③重啟docker服務
# systemctl restart docker
④運行registry的容器
# docker run -d -p 5000:5000 -v /tmp/registry:/var/lib/registry --name registry registry:latest
注:-v確保容器停止后,上傳的鏡像不會丟失。
⑤設置要上傳鏡像的tag
# docker tag hello-world 192.168.1.55:5000/hello-world
⑥將鏡像push到本地倉庫
# docker push 192.168.1.55:5000/hello-world
⑦查看
# curl http://192.168.1.55:5000/v2/_catalog
{"repositories":["hello-world"]}
2.生成singularity鏡像
# singularity build --nohttps hello-world.sif docker://192.168.1.55:5000/hello-world