freeseaboy 님의 멋있어 지려 노력하는 블로그

도커(9) 도커 이미지랑 놀기 본문

컴퓨터 & 서버/리눅스

도커(9) 도커 이미지랑 놀기

freeseaboy 2024. 11. 21. 20:57
반응형

자 오늘 1교시 도커 시간입니다.

일단 이미지 관련 내용이니 꾸준히 침착하게

영상 시청 바랍니다 ㅋ

바로 ㄱ

스크립밑

  ★위 포스팅 내용은 네X버 Blog 아래 링크에도 

똑같이 미러링 되어 있습니다.예비 Blg ​★  

https://blog.naver.com/iwseo7114

 

iwseo7114님의 블로그 : 네이버 블로그

안녕하세요. 일상 생활 공유에 관심이 많은 샐리엇입니다. 잘부탁드려요~ㅋ

blog.naver.com

 

#################################################################

자 안녕하세요 목요일입니다..자 바로 1교시 이어서

도커 할거에요...내용은 주말이 아니여서 적당히 할게요

양보단 질로...ㅇㅋ?

자 노래고 ~~~

- 도커 이미지

- 생성

- 구조

- 추출

- 배포

모든 컨테이너는 이미지를 기반으로 한다!!

도커는 기본적으로 도커 허브에서 이미지등을 풀 혹은 푸시한다

도커 허브는 공식적으로 도커에서 지원하는 이미지저장소 랍니다.

그리고 도커허브에서 이미지를 검색 할수있다

docker search 혹은 사이트방문 두개중 암거나 하셈

[root@C3 ~]# docker search nginx

NAME DESCRIPTION STARS OFFICIAL

nginx Official build of Nginx. 20371 [OK]

nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo… 96

nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN… 44

nginx/unit This repository is retired, use the Docker o… 64

nginx/nginx-ingress-operator NGINX Ingress Operator for NGINX and NGINX P… 2

nginx/nginx-quic-qns NGINX QUIC interop 1

nginx/unit-preview Unit preview features 0

nginx/nginxaas-loadbalancer-kubernetes 0

bitnami/nginx Bitnami container image for NGINX 193

ubuntu/nginx Nginx, a high-performance reverse proxy & we… 120

rancher/nginx 2

bitnamicharts/nginx Bitnami Helm chart for NGINX Open Source 0

kasmweb/nginx An Nginx image based off nginx:alpine and in… 8

rapidfort/nginx RapidFort optimized, hardened image for NGINX 15

redash/nginx Pre-configured nginx to proxy linked contain… 2

vmware/nginx 2

어쩌구 저쩌구 지금 당장할건

컨테이너 이미지를 재포장...

[root@C3 ~]# docker commit -a "seliot" -m "20241121" commit_os commit_os:0.1

sha256:808f8ce4e457b2732398ea54a0b883d41ca6c0c9aaee33af3ff98bb42a853a94

[root@C3 ~]# docker images;

REPOSITORY TAG IMAGE ID CREATED SIZE

commit_os 0.1 808f8ce4e457 12 seconds ago 196MB

확인!

[root@C3 ~]# docker run -it commit_os:0.1

root@0404f1432732:/# pwd

/

root@0404f1432732:/# ll

total 40

drwxr-xr-x. 21 root root 4096 Nov 21 11:23 ./

drwxr-xr-x. 21 root root 4096 Nov 21 11:23 ../

drwxrwxrwt. 2 root root 6 Dec 17 2019 tmp/

-rw-r--r--. 1 root root 13 Nov 21 11:18 topsecret.txt

drwxr-xr-x. 10 root root 4096 Dec 17 2019 usr/

drwxr-xr-x. 11 root root 4096 Dec 17 2019 var/

root@0404f1432732:/# cat topsecret.txt

I like Trump

root@0404f1432732:/#

도커 이미지 구조가 레이어가 있는데

즉 베이스가 있고 거기에 추가로 기능이나 사용자 정보들을

쌓고 또 거기에 쌓는 구조에요..이렇게 생각하세요.

말로 설명하면 엄청 길어지고 복잡해집니다.

"Layers": [

"sha256:f2fa9f4cf8fd0a521d40e34492b522cee3f35004047e617c75fadeb8bfd1e6b7",

"sha256:30d3c4334a2379748937816c01f5c972a8291a5ccc958d6b33d735457a16196e",

"sha256:83109fa660b2ed9307948505abd3c1f24c27c64009691067edb765bd3714b98d"

]

"Layers": [

"sha256:f2fa9f4cf8fd0a521d40e34492b522cee3f35004047e617c75fadeb8bfd1e6b7",

"sha256:30d3c4334a2379748937816c01f5c972a8291a5ccc958d6b33d735457a16196e",

"sha256:83109fa660b2ed9307948505abd3c1f24c27c64009691067edb765bd3714b98d",

"sha256:97892bd88e589fa095180bae16bc10a169578760efbe7d25f088da44589f6e6f"

]

},

즉 이말임ㅋ추가된다

[root@C3 ~]# !docker rmi

docker ps -a --filter ancestor=commit_os:0.1 rmi

"docker ps" accepts no arguments.

See 'docker ps --help'.

Usage: docker ps [OPTIONS]

List containers

[root@C3 ~]# docker ps -a --filter ancestor=commit_os:0.1^C

[root@C3 ~]# docker rmi commit_os:0.1

Untagged: commit_os:0.1

Deleted: sha256:808f8ce4e457b2732398ea54a0b883d41ca6c0c9aaee33af3ff98bb42a853a94

Deleted: sha256:e6eb2b031a408846777fe04cb4867e7ee74e57110634b0ca566af846b0abd0ed

[root@C3 ~]#

이미지 추출

[root@C3 ~]# docker save -o ubuntu:14.04.tar ubuntu:14.04

[root@C3 ~]# ll

total 4438868

-rw-------. 1 root root 206371840 Nov 21 20:50 ubuntu:14.04.tar

마지막 도커 이미지 배포는

이거는 특정 사설온프레미스 환경 혹은 퍼블릭 클라우드 아니면 도커허브 같은곳에

배포 한다고 보면 되요 이거는 지금 안할거니 이런게 있다 정도로만..

자 무튼 오늘 이렇게해서 도커 이미지를 좀 조져봤어요..

이해가 됨?안되도 걱정 ㄴㄴ 나중에 시간이 지나면 다됨

무튼 이렇게 수업을 마치고 다음에 또 이어서 진행할게요

수고링~~ㅋ

#################################################################

dk

반응형