Applications/LINUX

[Singularity] Docker 이미지를 Singularity 이미지로 변환하기

CRAY KOREA Blog 2024. 3. 14. 14:22

 

1. Docker repository의 이미지를 singularity이미지로 변경하는 경우

- 사용방법: singularity pull [저장할 이미지명] docker://[docker hub의 이미지명]

- 예제

# singularity pull determinedai/environments:cuda-11.3-pytorch-1.10-tf-2.8-gpu-096d730 \
docker://determinedai/environments:cuda-11.3-pytorch-1.10-tf-2.8-gpu-096d730

 

2. Local docker image 변환하는 경우

- Local docker image save 

[root@gnode01 test]# docker images
REPOSITORY                             TAG         IMAGE ID       CREATED         SIZE
registry                               2.8         0d153fadf70b   5 days ago      24.2MB
determinedai/install-validation-tool   0.17.14     1a2573d5e195   10 months ago   1.15GB
fluent/fluent-bit                      1.6         672c60a7ab2a   2 years ago     78.3MB
gcr.io/cadvisor/cadvisor               v0.36.0     7414b6ed960c   2 years ago     184MB
[root@gnode01 test]# docker save registry:2.8 -o registry.tar

 

- 저장한 docker image(예: registry.tar)를 singularity 이미지로 변환

# singularity build registry_2.8.sif docker-archive://registry.tar
INFO:    Starting build...
Getting image source signatures
Copying blob aa5968d388b8 done  
Copying blob 87e590a2171f done  
Copying blob 4c73096394f0 done  
Copying blob 492d9e01815a done  
Copying blob 7196c1bbaee2 done  
Copying config 0151ce0a97 done  
Writing manifest to image destination
Storing signatures
2023/02/17 13:45:12  info unpack layer: sha256:87500551ca7c83abb6fe89613e6935b65cd245d319e328db83d4bd40d039ecf5
2023/02/17 13:45:12  info unpack layer: sha256:2556ac2da07063397e4a67dffa631d6b0157abfdf3bc5d22b9320c99460f2ad4
2023/02/17 13:45:12  info unpack layer: sha256:baa6a96b40806623d4c08013d4398085784255850b28e642ed249d5d4855c9cd
2023/02/17 13:45:12  info unpack layer: sha256:50c52c4d9331f7836bcd07fb4bb4cd7871be001e8314d66a1a6278a15b6afb58
2023/02/17 13:45:12  info unpack layer: sha256:75da8b14b8b694ff2e3d75261d5f12850e98d8e8b5d26c0971d147000bd35f54
INFO:    Creating SIF file...
INFO:    Build complete: registry_2.8.sif
#

 

- 생성된 singularity 이미지 확인

# ls -rlt
total 32932
-rw------- 1 root root 24721920 Feb 17 13:44 registry.tar
-rwxr-xr-x 1 root root  8998912 Feb 17 13:45 registry_2.8.sif