docker images 커맨드로 다음과 같이 image list를 볼 수 있음
[root@kw1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
harbor.ks.io/ksflask v1 59db0b82b797 9 hours ago 913MB
harbor.ks.io/privatetest/ksflask v1 59db0b82b797 9 hours ago 913MB
python 3.9 40264b427ab5 39 hours ago 914MB
k8s.gcr.io/kube-proxy v1.23.5 3c53fa8541f9 9 days ago 112MB
calico/cni v3.22.1 2a8ef6985a3e 3 weeks ago 236MB
calico/pod2daemon-flexvol v3.22.1 17300d20daf9 3 weeks ago 19.7MB
calico/node v3.22.1 7a71aca7b60f 3 weeks ago 198MB
python 3.6 54260638d07c 3 months ago 902MB
kubernetesui/dashboard v2.4.0 72f07539ffb5 5 months ago 221MB
centos centos7 eeb6ee3f44bd 6 months ago 204MB
centos latest 5d0da3dc9764 6 months ago 231MB
k8s.gcr.io/pause 3.6 6270bb605e12 7 months ago 683kB
kubernetesui/metrics-scraper v1.0.7 7801cfc6d5c0 9 months ago 34.4MB
`docker rmi 이미지명:태그` 커맨드 혹은 `docker rmi 이미지ID` 커맨드로 이미지를 제거할 수 있음
그런데 이미지 지우려는 데 다음과 같은 에러가 발생함
[root@kw1 flaskImage]# docker rmi edd4429bca17
Error response from daemon: conflict: unable to delete edd4429bca17 (must be forced) - image is being used by stopped container 605e1fe0a9bd
605e1fe0a9bd 이 컨테이너에서 이미지를 쓰고 있다고 못 지운다고 함
확인해봄
[root@kw1 flaskImage]# docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e37f9b439f7b harbor.ks.io/ksflask:v1 "/bin/sh -c '['pytho…" 2 minutes ago Exited (127) 2 minutes ago fervent_wilson
605e1fe0a9bd harbor.ks.io/ksflask:v1 "/bin/sh -c '['pytho…" 5 minutes ago Exited (127) 5 minutes ago xenodochial_turing
10fc9d5ff29d harbor.ks.io/ksflask:v1 "/bin/sh -c '['pytho…" 5 minutes ago Exited (127) 5 minutes ago hungry_wu
7f66e4e15a7e 273a1c99e291 "/bin/sh -c 'yum ins…" 23 minutes ago Exited (1) 23 minutes ago strange_agnesi
2d19a00b8ab3 4517d736632a "/bin/sh -c 'yum ins…" 27 minutes ago Exited (1) 27 minutes ago ecstatic_leakey
ede37c3bf9f7 kubernetesui/dashboard "/dashboard --insecu…" 5 days ago Up 5 days k8s_kubernetes-dashboard_kubernetes-dashboard-6857959dd6-h5lm4_kubernetes-dashboard_30be962f-e090-4374-bbc1-a7a492ca83a4_0
bdf9a1143491 k8s.gcr.io/pause:3.6 "/pause" 5 days ago Up 5 days k8s_POD_kubernetes-dashboard-6857959dd6-h5lm4_kubernetes-dashboard_30be962f-e090-4374-bbc1-a7a492ca83a4_0
2d7befea386e 7801cfc6d5c0 "/metrics-sidecar" 5 days ago Up 5 days k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-799d786dbf-4tm9r_kubernetes-dashboard_586bf9d2-92c1-4c5d-bd0f-30d4e5233501_0
8e52b32784e5 k8s.gcr.io/pause:3.6 "/pause" 5 days ago Up 5 days k8s_POD_dashboard-metrics-scraper-799d786dbf-4tm9r_kubernetes-dashboard_586bf9d2-92c1-4c5d-bd0f-30d4e5233501_0
2bac828bdacd calico/node "start_runit" 6 days ago Up 6 days k8s_calico-node_calico-node-vpzhx_calico-system_61606a50-22da-4c22-b6a9-c2c30474782f_0
b55e48b02629 calico/cni "/opt/cni/bin/install" 6 days ago Exited (0) 6 days ago k8s_install-cni_calico-node-vpzhx_calico-system_61606a50-22da-4c22-b6a9-c2c30474782f_0
0a9935d65673 calico/pod2daemon-flexvol "/usr/local/bin/flex…" 6 days ago Exited (0) 6 days ago k8s_flexvol-driver_calico-node-vpzhx_calico-system_61606a50-22da-4c22-b6a9-c2c30474782f_0
90889b808814 k8s.gcr.io/kube-proxy "/usr/local/bin/kube…" 6 days ago Up 6 days k8s_kube-proxy_kube-proxy-sq298_kube-system_fc972596-775f-40a3-887f-e93a9402536e_0
24923d9cf1ea k8s.gcr.io/pause:3.6 "/pause" 6 days ago Up 6 days k8s_POD_calico-node-vpzhx_calico-system_61606a50-22da-4c22-b6a9-c2c30474782f_0
b23a24b8465d k8s.gcr.io/pause:3.6 "/pause" 6 days ago Up 6 days k8s_POD_kube-proxy-sq298_kube-system_fc972596-775f-40a3-887f-e93a9402536e_0
보니까 harbor.ks.io/ksflask:v1를 쓰는 docker container가 3개인데 전부 exited status임
`docker container rm container-id` 커맨드로 전부 지워줌
[root@kw1 flaskImage]# docker container rm e37f9b439f7b
컨테이너를 제거한 후 이미지를 다시 지우니까 잘 지워짐
[root@kw1 flaskImage]# docker rmi edd4429bca17
Untagged: harbor.ks.io/ksflask:v1
Deleted: sha256:edd4429bca17887f32341eb79c3e48713dfe9f96dff03aab779a2789964f97bb
Deleted: sha256:0944de18863e7eaf55de0441c5dabb186e7f32b8d3f646cb83bfed22e9012831
Deleted: sha256:0884e7a54b2e1bda57ff6b78979d67b63778ee56750ccae9c3ba5e6a7c3be7c9
Deleted: sha256:526848e44ae4195f0d6a8ce0aa9115dce98c69d4cc8b07d3bd73fb248c7c7fa1
Deleted: sha256:79043057b693c72672a109589af82a762a277a534236fb8aa30f7bb0c422f4b4
Deleted: sha256:8f1b408800e480c67152dabbf799733644c44da14f6732ee1b60f20371051a0d
Deleted: sha256:a1ea38c39f53b3104793124f2afa6983ca897bbd531363b720f5e7cd3d9d7eb7
Deleted: sha256:f7c42d642e0020f064f07cdef63b00c0d7691b765bd64f837faa7eaf105660e5
Deleted: sha256:ed9fb3ece5c804fa6aa2186aa884f873d2f53491d042b89170067f6dad01b6a9
'kubenetes' 카테고리의 다른 글
kubernetes pod에 파일 복사하고 다운로드 받기 (0) | 2022.03.30 |
---|---|
kubernetes python flask ingress 설정하기 (0) | 2022.03.27 |
Dockerfile로 flask web docker image build 하는 방법 (0) | 2022.03.23 |
let's encrypt의 certbot을 사용해 harbor https 적용하기 (0) | 2022.03.22 |
harbor 설치 (2) | 2022.03.21 |
댓글