[๐Ÿณ Docker ๐Ÿณ]Docker Image, Container

Yohan_05ยท2023๋…„ 1์›” 28์ผ
0

Docker

๋ชฉ๋ก ๋ณด๊ธฐ
1/11
post-thumbnail
post-custom-banner

๋„์ปค ๊ตฌ์„ฑ ์š”์†Œ

  • client, docker host, docker registry ๋กœ ์ด๋ฃจ์–ด์ ธ์žˆ๋‹ค.
  • client : docker ๋ช…๋ น์–ด๊ฐ€ ํด๋ผ์ด์–ธํŠธ ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค๊ณ  ๋ณด๋ฉด๋œ๋‹ค.
  • docker daemon(engine)์ด ๋„์›Œ์ ธ์žˆ๋Š” ์„œ๋ฒ„๋ฅผ docker host ๋ผ๊ณ ํ•จ. image ์™€ container ๋ฅผ ๊ด€๋ฆฌ.
  • image ๋Š” ์ง์ ‘ ๋นŒ๋“œํ•˜๋Š” ๋ฐฉ๋ฒ•๊ณผ pull ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๋ฐ›์•„์˜ค๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์Œ.
  • registry์˜ ์ด๋ฏธ์ง€๋ฅผ ํ’€์ด๋‚˜ ๋Ÿฐ์„ ํ†ตํ•ด ํ˜ธ์ŠคํŠธ์— ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋˜๊ณ , ์ €์žฅ๋œ ์ด๋ฏธ์ง€๋ฅผ ํ†ตํ•ด์„œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ—นํ•˜์—ฌ docker daemon์ด ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒŒ๋œ๋‹ค.

๋„์ปค ์ด๋ฏธ์ง€์™€ ์ปจํ…Œ์ด๋„ˆ

์ด๋ฏธ์ง€์™€ ์ปจํ…Œ์ด๋„ˆ๋Š” ๋„์ปค์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ ๋‹จ์œ„์ด๋‹ค. ์ด๋ฏธ์ง€์™€ ์ปจํ…Œ์ด๋„ˆ๋Š” 1:N ๊ด€๊ณ„์ด๋‹ค.

์ด๋ฏธ์ง€

์ด๋ฏธ์ง€๋Š” ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ํ•„์š”ํ•œ ์š”์†Œ๋กœ, ์ปจํ…Œ์ด๋„ˆ์˜ ๋ชฉ์ ์— ๋งž๋Š” ๋ฐ”์ด๋„ˆ๋ฆฌ์™€ ์˜์กด์„ฑ์ด ์„ค์น˜๋˜์–ด์žˆ๋‹ค. ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ณ„์ธต์œผ๋กœ ๋œ ๋ฐ”์ด๋„ˆ๋ฆฌ ํŒŒ์ผ๋กœ ์กด์žฌ

์ปจํ…Œ์ด๋„ˆ

ํ˜ธ์ŠคํŠธ์™€ ๋‹ค๋ฅธ ์ปจํ…Œ์ด๋„ˆ๋กœ๋ถ€ํ„ฐ ๊ฒฉ๋ฆฌ๋œ ์‹œ์Šคํ…œ ์ž์›๊ณผ ๋„คํŠธ์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กœ์„ธ์Šค. ์ด๋ฏธ์ง€๋Š” ์ฝ๊ธฐ ์ „์šฉ์œผ๋กœ ์‚ฌ์šฉํ•˜์—ฌ ๋ณ€๊ฒฝ์‚ฌํ•ญ์€ ์ปจํ…Œ์ด๋„ˆ ๊ณ„์ธต์— ์ €์žฅ. => ์ปจํ…Œ์ด๋„ˆ ๋ฌด์Šจ ์ผ์„ ํ•˜๋“  ์ด๋ฏธ์ง€๋Š” ์˜ํ–ฅ์„ ๋ฐ›์ง€ ์•Š์Œ.

  • DockerFile์„ build -> docker image, docker image๋ฅผ run -> docker container

๋„์ปค ์ด๋ฏธ์ง€ ์ด๋ฆ„ ๊ตฌ์„ฑ

  • ์ €์žฅ์†Œ ์ด๋ฆ„, ์ด๋ฏธ์ง€ ์ด๋ฏธ์ง€ ํƒœ๊ทธ๋กœ ์ด๋ฃจ์–ด์ ธ์žˆ๋‹ค.
  • Docker image๋ฅผ pull/ push ์‹œ์— ์ €์žฅ์†Œ ์ด๋ฆ„์€ ์ƒ๋žตํ•˜๋ฉด ๊ธฐ๋ณธ ์ €์žฅ์†Œ์ธ ๋„์ปค ํ—ˆ๋ธŒ๋กœ ์ธ์‹
  • Docker image tag๋ฅผ ์ƒ๋žตํ•˜๋ฉด ์ตœ์‹  ๋ฆฌ๋น„์ „์„ ๊ฐ€๋ฆฌํ‚ค๋Š” latest๋กœ ์ธ์‹

๋„์ปค ์ด๋ฏธ์ง€ ์ €์žฅ์†Œ

  • ์ด๋ฏธ์ง€ ์ €์žฅ์†Œ(repository) _ ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ๊ณต์œ ํ•˜๊ธฐ ์œ„ํ•œ ์„œ๋ฒ„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ (AWS์˜ ECR์ด๋‚˜ docker hub ๋“ฑ์ด ์žˆ๋‹ค.)
  • private, public ์œ ํ˜•์ด ์žˆ์Œ.
profile
์•ˆ๋…•ํ•˜์„ธ์š” DevOps ์—”์ง€๋‹ˆ์–ด๋กœ ํ˜„์—…์—์„œ ํ™œ๋™์ค‘์ธ ์š”ํ•œ์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€