Cloud Engineering/Docker ๐Ÿณ

Intro ์ง€์ธ๋“ค๊ณผ ์‚ฌ์ด๋“œ ํ”„๋กœ์ ํŠธ๋กœ ๊ฐœ๋ฐœํ•œ Django ์•ฑ์„ deploy ํ•ด๋ณด๋Š” ์˜ˆ์ œ๋กœ Docker Image๋ฅผ ๋ฐฐํฌํ•˜๋Š” ๊ฐ„๋‹จํ•œ hands on ์„ ์†Œ๊ฐœํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Docker Image๋กœ ๊ด€๋ฆฌํ•˜๋Š”๊ฒŒ ๋ฐฐํฌํ•  ๋•Œ ๋ฒ„์ „๊ด€๋ฆฌ๋‚˜ ํ™˜๊ฒฝ ๊ตฌ์ถ• ์‹œ์— ํŽธ๋ฆฌํ•  ๊ฒƒ ๊ฐ™์•„์„œ Imageํ™”ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ์•„๋ž˜์˜ Git Repository ๊ฐ€ ๊ฐœ๋ฐœํ•œ Django ์•ฑ ์ž…๋‹ˆ๋‹ค. https://github.com/FoodieZone/Backend GitHub - FoodieZone/Backend Contribute to FoodieZone/Backend development by creating an account on GitHub. github.com ์ž‘์—… ๋ฐ ๋ฐฐํฌ ํ™˜๊ฒฝ Host Server : ubuntu 22.04 Cloud S..
ํ”„๋กœ์ ํŠธ์—์„œ ์˜จํ”„๋ ˆ๋ฏธ์Šค ํ™˜๊ฒฝ์— ์žˆ๋Š” MongoDB ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ AWS DMS ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ S3๋กœ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์„ ํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค..!! DMS CDC ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด๋ณด๊ธฐ ์œ„ํ•ด์„œ mongoDB ๋ ˆํ”Œ๋ฆฌ์นด ์…‹์„ ๊ตฌ์ถ•ํ•ด๋ณด๊ฒŒ ๋˜์—ˆ๋‹ค. MongoDB ReplicaSet ์ด๋ž€ ? Replica Set์€ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค์—์„œ๋„ ๋“ฑ์žฅํ•˜๋Š”๋ฐ, Mongo DB์—์„œ๋Š” ๊ด€์ ์ด ์กฐ๊ธˆ ๋‹ค๋ฅด๋‹ค. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์—ฌ๋Ÿฌ ์„œ๋ฒ„์— ๋™์ผํ•œ ๋ฐ์ดํ„ฐ ์…‹์„ ์ €์žฅํ•˜๊ณ  ์šด์˜ํ•˜๊ธฐ ์œ„ํ•œ ํด๋Ÿฌ์Šคํ„ฐ์ด๋‹ค. Replica Set์„ ๊ตฌ์„ฑํ•ด์„œ, ํ•˜๋‚˜์˜ ์„œ๋ฒ„์— ์žฅ์• ๊ฐ€ ์ผ์–ด๋‚˜๋”๋ผ๋„ ๋‹ค๋ฅธ ์„œ๋ฒ„๊ฐ€ ๋™์ผํ•œ ๋ฐ์ดํ„ฐ ์…‹์„ ์šด์˜ํ•  ๊ฒƒ์ด๋ฏ€๋กœ ๊ฐ€์šฉ์„ฑ์„ ๋ณด์žฅํ•  ์ˆ˜ ์žˆ๋‹ค. Replica Set ์˜ ํŒจํ„ด MongoDB์—์„œ ๋ ˆํ”Œ๋ฆฌ์นด์…‹์„ ๊ตฌ์„ฑํ•˜๋Š” ํŒจํ„ด์€ ํฌ๊ฒŒ ๋‘๊ฐ€์ง€์ด๋‹ค. 1. PSS (Prima..
HTTPS๊ฐ€ ๋ณด์•ˆ์ƒ ์šฐ์ˆ˜ํ•˜์ง€๋งŒ ๊ฐ„๋‹จํ•œ HTTP๋กœ ๊ตฌ์ถ•ํ•  ์ˆ˜๋„ ์žˆ๋‹ค. https://sinclairstudio.tistory.com/413 [Docker] Harbor HTTPS ๊ตฌ์„ฑ์œผ๋กœ ๊ตฌ์ถ•ํ•˜๊ธฐ 1. Harbor ์„ค์น˜ https://github.com/goharbor/harbor GitHub - goharbor/harbor: An open source trusted cloud native registry project that stores, signs, and scans content. An open source trusted cloud native registry project that stores, signs, and scans con sinclairstudio.tistory.com Harbor & ..
๋‹ค์šด๋กœ๋“œ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” registry ๊ฒ€์ƒ‰ํ•˜๊ธฐ $ docker search registry registry image ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ธฐ $ docker image pull registry:latest registry ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๋„์›Œ์ฃผ๋ฉด ๊ตฌ์ถ•์ด ์™„๋ฃŒ๋œ๋‹ค. docker registry ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ํฌํŠธ๊ฐ€ 5000๋ฒˆ์ด๋‹ค ! $ docker container run -d -p 5000:5000 registry:latest PRIVATE REGISTRY์—์„œ ์ด๋ฏธ์ง€ ํ™•์ธํ•˜๋Š” ๋ช…๋ น์–ด [user@localhost ~]$ curl -X GET http://localhost:5000/v2/_catalog {"repositories":[]} ํ˜•์‹์— ๋งž๊ฒŒ registry์— ์˜ฌ๋ฆด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•œ๋‹ค $ docker im..
1. Harbor ์„ค์น˜ https://github.com/goharbor/harbor GitHub - goharbor/harbor: An open source trusted cloud native registry project that stores, signs, and scans content. An open source trusted cloud native registry project that stores, signs, and scans content. - GitHub - goharbor/harbor: An open source trusted cloud native registry project that stores, signs, and ... github.com ์›ํ•˜๋Š” ๋ฆด๋ฆฌ์ฆˆ ๋ฒ„์ „ ํŒŒ์ผ์˜ ๋งํฌ๋ฅผ ๋ณต..
docker push ๋„์ปค ์ €์žฅ์†Œ์— ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์šฐ์„  ๋กœ๊ทธ์ธ์„ ํ•ด์•ผํ•œ๋‹ค. $ docker login ๋กœ๊ทธ์ธ์ด ๋˜๋ฉด push ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œ ํ•œ๋‹ค. ์ด๋ฏธ์ง€ ํŒŒ์ผ์˜ ์ด๋ฆ„ ํ˜•์‹์„ ๊ผญ ์ง€์ผœ์ฃผ์–ด์•ผ ํ•œ๋‹ค !! $ docker push ๋„์ปคํ—ˆ๋ธŒ_์‚ฌ์šฉ์žID/IMAGE:TAG ์—…๋กœ๋“œํ•œ ์ด๋ฏธ์ง€ ๋˜ํ•œ pull ๋ช…๋ น์–ด๋กœ ๋กœ์ปฌ์— ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ๋‹ค.
1. commit ๋ช…๋ น์–ด๋กœ ์ปจํ…Œ์ด๋„ˆ๋กœ ์ด๋ฏธ์ง€ ์ƒ์„ฑ $ docker container commit [OPTION] CONTAINER NEW_IMAGE_REPO:TAG $ docker commit [OPTION] CONTAINER NEW_IMAGE_REPO:TAG [์˜ˆ์‹œ] centos-test1์ด๋ผ๋Š” ์ปจํ…Œ์ด๋„ˆ๋ฅผ mycentos:first ์ด๋ฏธ์ง€๋กœ ์ƒ์„ฑํ•œ๋‹ค. [user@localhost ~]$ docker container commit centos-test1 mycentos:first sha256:d10bbb77df85ae628a43a2e83135de2c2501dc81f9799fdd4c368e9971c776bc mycentos:first ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. [user@localhost ~]..
-p ์˜ต์…˜์„ ์ง€์ •ํ•˜์—ฌ ํฌํŠธํฌ์›Œ๋”ฉ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. $ docker container run -dt -p HOST_PORT:CONTAINER_PORT --name CONTAINER IMAGE_REPO:TAG ๋ธŒ๋ฆฟ์ง€ ๋„คํŠธ์›Œํฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ชจ๋“  ์ปจํ…Œ์ด๋„ˆ๋Š” ์™ธ๋ถ€์—์„œ ์ ‘์†ํ•  ๋•Œ ํฌํŠธํฌ์›Œ๋”ฉ์„ ํ•ด์•ผ ์ ‘๊ทผ๊ฐ€๋Šฅํ•˜๋‹ค. ์˜ˆ์‹œ web2 ์ปจํ…Œ์ด๋„ˆ์— 8080๋ฒˆ ํฌํŠธ๋กœ ์ ‘๊ทผํ•˜๋Š” ๊ฒฝ์šฐ 80๋ฒˆ ํฌํŠธ๋กœ ํฌํŠธํฌ์›Œ๋”ฉํ•˜๋Š” ์˜ˆ์‹œ์ด๋‹ค. [user@localhost ~]$ docker run -d -p 8080:80 --name web2 httpd:latest 8864c0be9446bd844ec08e882f12e94c376f156c4a29bf55375020c82fb9c965 ํ˜„์žฌ ์‹คํ–‰์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก์„ ํ†ตํ•ด ํฌํŠธ ํฌ์›Œ๋”ฉ์ด ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ..
minjiwoo
'Cloud Engineering/Docker ๐Ÿณ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก