โ˜๏ธ Cloud Native/๐Ÿณ Docker

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Docker๋ฅผ ํ™œ์šฉํ•œ Ngnix Container ์„ค์ •, ๊ด€๋ฆฌ & Docker hub ๋ฐฐํฌ

์ด๋ฒˆ์—๋Š” Python Programming ํ™˜๊ฒฝ์„ Container๋กœ ์ œ๊ณตํ•ด ๋ณด๊ธฐ ์œ„ํ•œ ์‹ค์Šต์„ ํ•œ๋ฒˆ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.Docker ์ปจํ…Œ์ด๋„ˆ์— Python ์ด๋ฏธ์ง€ ์„ค์น˜ ๋ฐ ์‹คํ–‰ # ์ƒ˜ํ”Œ ์†Œ์Šค ์ฝ”๋“œ ์ž‘์„ฑ(๋กœ๋˜ ํ”„๋กœ๊ทธ๋žจ)$ vi py_lotto.pyfrom random import shufflefrom time import sleepgamenum = input('๋กœ๋˜ ๊ฒŒ์ž„ ํšŸ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”: ')for i in range(int(gamenum)): balls = [x+1 for x in range(45)] ret = [] for j in range(6): shuffle(balls) # balls๋ฅผ ๋ฌด์ž‘์œ„๋กœ ์„ž๊ณ , number = balls.pop() ..

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Docker Container ๋ช…๋ น์–ด (with Ngnix Container ์‹คํ–‰)

์ด๋ฒˆ์—๋Š” Docker Container ๋ช…๋ น์–ด๋“ค์— ๋ฐํ•˜์—ฌ ํ•œ๋ฒˆ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.์ด๋ฏธ์ง€๋Š” ์ฝ๊ธฐ ์ „์šฉ์˜ ๋ถˆ๋ณ€ ๊ฐ’์œผ๋กœ ๋งŒ๋“ค์–ด์ง‘๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋„์ปค ์—”์ง„์€ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋•Œ ์ด๋ฏธ์ง€์™€ ํ•จ๊ป˜ ์ฝ๊ณ  ์“ฐ๊ธฐ๊ฐ€ ๊ฐ€๋Šฅํ•œ ๋ ˆ์ด์–ด๋ฅผ ์ถ”๊ฐ€ํ•ด์„œ ๋งŒ๋“ค์–ด์ง€๋Š” ๊ฒƒ์ด ์ปจํ…Œ์ด๋„ˆ ์ž…๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ์ปจํ…Œ์ด๋„ˆ ๊ตฌ๋™, ์ ‘๊ทผ, ๋กœ๊ทธ, ์šด์˜ ๋“ฑ์˜ ๋ช…๋ น์„ ๋‹ค๋ค„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด๋ฏธ์ง€์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์ปจํ…Œ์ด๋„ˆ ๋ช…๋ น๋„ dockerd ๋ฐ๋ชฌ์ด ์ œ๊ณตํ•˜๋Š” docker CLI API๋ฅผ ํ†ตํ•ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.๋„์ปค ์ด๋ฏธ์ง€๋Š” ์ปจํ…Œ์ด๋„ˆ ๋™์ž‘๊ณผ ๊ด€๋ จ๋œ ์ฝ˜ํ…์ธ ๋ฅผ ์ œ๊ณตํ•˜๊ณ  ์ด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ปจํ…Œ์ด๋„ˆ์˜ ๋™์ž‘์ด ์ด๋ฃจ์–ด ์ง‘๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ปจํ…Œ์ด๋„ˆ ๋ช…๋ น ๋Œ€๋ถ€๋ถ„์ด ์„œ๋น„์Šค ์‹คํ–‰ ๋ฐ ์šด์˜๊ณผ ๊ด€๋ จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.Container๋Š” Process๋‹ค๋„์ปค ์ปจํ…Œ์ด๋„ˆ๋Š” ์•ž์„œ ๋ฐฐ์šด ๋„์ปค ..

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Docker ๋ช…๋ น์–ด ํ™œ์šฉ Part.2

๋„์ปค ์ด๋ฏธ์ง€ ํƒœ๊ทธ ์„ค์ •๊ณผ ๋„์ปค ๋กœ๊ทธ์ธ ๋ฐ ๋กœ๊ทธ์•„์›ƒDocker Login & Logout ๋ถ€๋ถ„๋ถ€ํ„ฐ ์ด์–ด์„œ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.๋„์ปค ํƒœ๊ทธ(tag)๋Š” ์›๋ณธ ์ด๋ฏธ์ง€์— ์ฐธ์กฐ ์ด๋ฏธ์ง€ ์ด๋ฆ„์„ ๋ถ™์ด๋Š” ๋ช…๋ น์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.docker tag ์›๋ณธ ์ด๋ฏธ์ง€[:ํƒœ๊ทธ] ์ฐธ์กฐ ์ด๋ฏธ์ง€[:ํƒœ๊ทธ]ํƒœ๊ทธ ์„ค์ •์€ ์ƒˆ๋กœ์šด ์ฐธ์กฐ๋ช…์„ ๋ถ™์ด๋Š” ์ž‘์—…์ด๋ฏ€๋กœ ์ด๋ฏธ์ง€ ID๋Š” ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.Example์ด๋ฏธ์ง€ ID์— ์„ธ๋ถ€ ์ •๋ณด(OS, ๋ฒ„์ „ ๋“ฑ)๋ฅผ ๋ถ™์—ฌ ํƒœ๊ทธ ์ง€์ •:toby@tobykakao:~$ docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdebian latest d36fff645336 13 days ago 139MBnginx ..

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Docker ๋ช…๋ น์–ด ํ™œ์šฉ Part.1

Docker Container Service๋ฅผ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•œ Docker ๋ช…๋ น์–ด(CLI)์— ๋ฐํ•˜์—ฌ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.๋ชจ๋“  Docker ๋ช…๋ น์€ ํ‚ค์›Œ๋“œ๋กœ docker๋ฅผ ์•ž์— ์‚ฌ์šฉํ•˜๊ณ  ๊ธฐ๋ณธ์ ์ธ ๋ช…๋ น์–ด ์‚ฌ์šฉ๋ฒ•์€ help ๋ช…๋ น์„ ํ†ตํ•ด ํ™•์ธํ•˜๊ฑฐ๋‚˜ docker์—์„œ ์ œ๊ณตํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ ํ•ฉ๋‹ˆ๋‹ค.docker COMMAND -helpDocker image ๋ช…๋ น์–ด๋„์ปค image๋Š” docker์˜ ํ•ต์‹ฌ๊ธฐ์ˆ ์ด๋ฉฐ ์ฝ”๋“œ๋กœ ๊ฐœ๋ฐœ๋œ ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€ ํ™˜๊ฒฝ ์ •๋ณด(Binary, Library, ๊ฐ์ข… Tool๋“ฑ)์„ ๊ณ ์Šค๋ž€ํžˆ ๋ณต์ œํ•ด์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Docker Container๋กœ ์‚ฌ์šฉํ•  Docker image๋Š” docker search๋ฅผ ํ†ตํ•ด ์กฐํšŒํ•˜๋ฉด Docker Hub ๋ฐ ๊ฐœ์ธ ์‚ฌ์šฉ์ž๋“ค์ด ๊ณต๊ฐœํ•œ ๊ด€๋ จ ์ด๋ฏธ์ง€๋ฅผ ์‚ดํŽด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Local ..

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Docker Installation Check (๋„์ปค ์„ค์น˜ ํ™•์ธ)

ํ•œ๋ฒˆ ์„ค์น˜ํ•œ Docker Engine์„ ํ†ตํ•ด ์ฒซ image๋ฅผ ๋‹ค์šด๋กœ๋“œ ํ•ด๋ณด๋ฉด์„œ ์ปจํ…Œ์ด๋„ˆ ์„œ๋น„์Šค๋ฅผ ํ•œ๋ฒˆ ๊ฐ€๋™์‹œ์ผœ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.Docker Container Service๋ฆฌ๋ˆ…์Šค ์ปจํ…Œ์ด๋„ˆ์˜ ๋ฏธ๋ž˜ ๋ผ๋Š” ์ œ๋ชฉ์œผ๋กœ ๋„์ปค ์—”์ง„์„ ์ฒ˜์Œ ๋ฐœํ‘œํ•œ ์†”๋กœ๋ชฌ ํ•˜์ต์Šค๋Š” docker ๋ผ๋Š” ์ƒˆ๋กœ์šด ๋ช…๋ น์œผ๋กœ ‘Hello World’ ๋ฌธ์ž์—ด์„ ์ถœ๋ ฅํ•˜๋Š” ๋ฐ๋ชจ๋ฅผ ํ•œ๋ฒˆ ์‹œ์—ฐํ–ˆ์Šต๋‹ˆ๋‹ค.# docker hub ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ์ œ๊ณตํ•˜๋Š” busy box image๋ฅผ ๋‹ค์šด๋กœ๋“œ ํ›„ ์กฐํšŒํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.toby@tobykakao:~$ docker pull busyboxUsing default tag: latestlatest: Pulling from library/busyboxDigest: sha256:768e5c6f5cb6db0794eec98dc7a967f40..

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Ubuntu์— Docker Community Edition (CE) ์„ค์น˜

ํ•œ๋ฒˆ UTM์— ์„ค์น˜ํ•œ ๊ฐ€์ƒ๋จธ์‹ (VM) Ubuntu์— Docker Community Edition Version์„ ํ•œ๋ฒˆ ์„ค์น˜ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.Docker Community Edition ์„ค์น˜ํ•ด๋ณด๊ธฐ (Terminal ver.)Ubuntu์—์„œ Terminal์„ ์—ฐ ๋‹ค์Œ, ํ•œ๋ฒˆ ์„ค์น˜ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.๋จผ์ €, ํ˜„์žฌ ์šฐ๋ถ„ํˆฌ ๋ฒ„์ „์„ ํ™•์ธํ•ด์ค๋‹ˆ๋‹ค.cat /etc/lsb-releasetoby@tobykakao:~$ cat /etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=24.04DISTRIB_CODENAME=nobleDISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"์ตœ์‹  ํŒจํ‚ค์ง€๋กœ ์—…๋ฐ์ดํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•ด์ค๋‹ˆ๋‹ค.sudo apt-get updatetoby@tobykakao:~$ ..

โ˜๏ธ Cloud Native/๐Ÿณ Docker

[Docker] Docker Install (๋„์ปค ์„ค์น˜ with UTM, Ubuntu install)

Docker์— ๋Œ€ํ•œ ๋ณด์ถฉ ๊ฐœ๋… ์„ค๋ช… ๋ฐ Docker๋ฅผ ์„ค์น˜ํ•  VM(๊ฐ€์ƒ๋จธ์‹ )์„ ํ•œ๋ฒˆ ์„ค์น˜ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.Docker?์•ž์—์„œ Docker์— ๋Œ€ํ•˜์—ฌ ๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค๋ช…์„ ํ–ˆ์ง€๋งŒ, ํ•œ๋ฒˆ ๋” ๊ฐ„๋žตํžˆ ์„ค๋ช…ํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๋„์ปค๋Š” ๊ธฐ์กด์˜ ๋ฆฌ๋ˆ…์Šค ์ปจํ…Œ์ด๋„ˆLXC ๊ธฐ์ˆ ์„ ์ด์šฉํ•˜์—ฌ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ปจํ…Œ์ด๋„ˆ๋กœ์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“ค์—ˆ๊ณ , ์„ค์น˜ ํ›„ ๋ฒ„์ „ ์ •๋ณด docker version๋ฅผ ํ™•์ธํ•ด ๋ณด๋ฉด Go ์–ธ์–ด๋กœ ๊ตฌ์„ฑ๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ถœ์‹œ ์ดํ›„ ๊พธ์ค€ํ•œ ๊ธฐ์ˆ  ๊ฐœ๋ฐœ์„ ํ†ตํ•ด ์‚ฌ์‹ค์ƒ ์ปจํ…Œ์ด๋„ˆ ๊ฐ€์ƒํ™”๋ฅผ ์ด์šฉํ•œ ์ฐจ์„ธ๋Œ€ ํด๋ผ์šฐ๋“œ ์ธํ”„๋ผ ์„ค๋ฃจ์…˜ next generation cloud infrastructure solution์˜ ํ‘œ์ค€์ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.๋„์ปค์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ปจํ…Œ์ด๋„ˆ ๊ฐ€์ƒํ™” ๊ธฐ์ˆ ์˜ ๋ณ€ํ™”์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.์ดˆ๊ธฐ ๋„์ปค๋Š” ๋ฆฌ๋ˆ…์Šค ์ปจ..

Bigbread1129
'โ˜๏ธ Cloud Native/๐Ÿณ Docker' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)