๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Server/Docker

[Docker] Docker ๊ฐ€์ด๋“œ ๋”ฐ๋ผํ•ด๋ณด๊ธฐ

by soy๋ฏธ๋‹ˆ 2021. 10. 1.

 

 

 

๋„์ปค Getting Started Document ๋”ฐ๋ผ์„œ ํ•ด๋ณด๊ธฐ

 

1. ๋„์ปค ๊นƒํ—ˆ๋ธŒ ์—์„œ Download ZIP

 

๐Ÿ’ก ์••์ถ• ํ’€๊ณ  VSCode ์—์„œ app ํด๋” ์—ด๊ธฐ

๐Ÿ’ก package.json ํŒŒ์ผ๊ณผ ๋™์ผํ•œ ์œ„์น˜์— Dockerfile ์ž‘์„ฑ

 

 

 

 

๐Ÿ’ก app ํด๋” ์œ„์น˜์—์„œ ํ„ฐ๋ฏธ๋„ ์—ด๊ณ  docker build -t getting-started . ํ•ด์„œ ์ด๋ฏธ์ง€ ๋นŒ๋“œ (์ด๋ฏธ์ง€ ์ด๋ฆ„์„ getting-started ๋กœ ์ง€์ •)

๐Ÿ’ก docker run -dp 3000:3000 getting-started ํ•ด์„œ ์ปจํ…Œ์ด๋„ˆ ์‹œ์ž‘

 

 

 

๐Ÿ’ก ๋„์ปคGUI์—์„œ ๋นŒ๋“œํ•œ ์ปจํ…Œ์ด๋„ˆ ํด๋ฆญ ํ›„ OPEN IN BROWSER 

 

 


 

2. ์•ฑ ์—…๋ฐ์ดํŠธ

 

๐Ÿ’ก src/static/js/app.js ํŒŒ์ผ ๋“ค์–ด๊ฐ€์„œ 56๋ฒˆ์งธ ์ค„ ์ฝ”๋“œ ๋ณ€๊ฒฝ

 

 

 

๐Ÿ’ก app ํด๋” ์œ„์น˜์—์„œ ํ„ฐ๋ฏธ๋„ ์—ด๊ณ  docker build -t getting-started . ํ•ด์„œ ์ˆ˜์ •๋œ ์ด๋ฏธ์ง€ ๋นŒ๋“œ

๐Ÿ’ก docker run -dp 3000:3000 getting-started ํ•ด์„œ ์ปจํ…Œ์ด๋„ˆ ์‹œ์ž‘

๐Ÿ’ก ์ฃผ์˜ํ•  ์  : ์ปจํ…Œ์ด๋„ˆ run ํ•˜๊ธฐ ์ „์— ํ˜„์žฌ run ์ง„ํ–‰์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ค‘์ง€ ๋˜๋Š” ์‚ญ์ œํ•ด์ค˜์•ผ ํ•œ๋‹ค.

 

 

 

 

๐Ÿ’ก ์ปจํ…Œ์ด๋„ˆ ์ค‘์ง€ ํ•˜๋Š” ๋ฒ•

 

๋„์ปค GUI ๋กœ ์ค‘์ง€ ๋˜๋Š” ์‚ญ์ œ

 

๐Ÿ’ก ๋ช…๋ น์–ด

docker ps : ์ƒ์„ฑ๋œ ์ปจํ…Œ์ด๋„ˆ ๋ฆฌ์ŠคํŠธ ํ™•์ธ

docker restart <the-container-id> : id๋กœ ์ปจํ…Œ์ด๋„ˆ ์žฌ์‹œ์ž‘

docker stop <the-container-id> : id๋กœ ์ปจํ…Œ์ด๋„ˆ ์ค‘์ง€

docker rm <the-container-id> : ์ปจํ…Œ์ด๋„ˆ ์‚ญ์ œ

 

 


 

3. ์•ฑ ๊ณต์œ 

 

๐Ÿ’ก Docker Hub ์— ๋กœ๊ทธ์ธํ•˜๊ณ  ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ์ƒ์„ฑ

 

 

 

๐Ÿ’ก ์ƒ์„ฑํ•œ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ์— ์ด๋ฏธ์ง€ ํ‘ธ์‹œ

 

 

๐Ÿ’ก ๋„์ปค ๋กœ๊ทธ์ธํ•˜๊ณ  ์ด๋ฏธ์ง€ ํ‘ธ์‹œ

 

 

๐Ÿ’ก ์ƒˆ ์ธ์Šคํ„ด์Šค์—์„œ docker ๋กœ๊ทธ์ธ ํ›„ ์ด๋ฏธ์ง€ ์‹คํ–‰

 

 

 

๋Œ“๊ธ€