반응형

 

Docker 및 Ctr 로 하는 법 -

2024.04.10 - [Develop/기타 작업] - Docker architecture, save, load, tag 및 ctr tag, export, import, push

 

buildah 에서 docker save, ctr export 과 같은 이미지를 로컬에 저장하고 싶으면,

buildah push 명령어를 사용하면된다.

# buildah push <image-id> oci-archive:/경로/이미지.tar:tag
buildah push 5854065bab5a oci-archive:/root/test.tar:latest

 

이후 ctr image imports 나 docker load 등으로 이미지를 올린 후 조회하면, 아래와 import-yyyy-mm-dd같이 나온다.

docker.io/library/import-2025-03-18 

crictl images
IMAGE                                                TAG                 IMAGE ID            SIZE
docker.io/library/import-2025-03-18                  latest              5854065bab5af       62.9MB

 

적절히 변경하여 사용한다.

 

기타 : buildah 로 push 후 ctr 로 업로드하면 crictl에 조회는 되지만 태그 변경이 안되는데,

이 경우 ctr imge list 로 조회 후 정확한 이름을 찾아서 변경하면된다.

(기본적으로 변경시 Source가 docker.io/library/import-2025-03-18 이 아닌 import-2025-03-18 로 Source를 선택 후

태그를 변경하면된다.

 

반응형
반응형

 

1. Docker 아키텍쳐 pull

docker pull --platform linux/amd64 nginx:latest

 

2. Docker image 저장

docker save -o a.tar imagenams

 

3. Docker image 업로드

docker load -i a.tar

 

4. Docker image 태그 변경

docker image tag imageid a:1.0

 

5. Docker 아키텍처 빌드

docker build --platform linux/amd64 -t test:1.0 .

 

6. ctr export

# namespace k8s.io export
ctr -n=k8s.io images export nginx.tar nginxt:latest

# default namespace
ctr images export nginx.tar nginxt:latest

 

7. ctr import

# namespace k8s.io import
ctr -n=k8s.io images import nginx.tar

# default namespace
ctr images import nginx.tar

 

8. ctr image tag 변경

ctr -n=k8s.io image tag 기존이미지태그 변경할이미지태그

 

9. ctr push id/password

## https
ctr -n=k8s.io image push imagename -u "id:password"

## http일 경우
ctr -n=k8s.io image push imagename -u "id:password" --plain-http

 

반응형

+ Recent posts