์ƒ์„ธ ์ปจํ…์ธ 

๋ณธ๋ฌธ ์ œ๋ชฉ

[TIL] ๋„์ปค ํฌํŠธ ๋ฒˆํ˜ธ ์„ค์ •ํ•˜๊ธฐ 221109

CLOUD/Docker

by ์—์Šคํ”„๋ฆฌํ„ฐ 2022. 11. 10. 11:29

๋ณธ๋ฌธ

728x90
๐Ÿ“
๐Ÿ’ก
Today I Learned ์š”์•ฝ (31ํšŒ์ฐจ) - ๋„์ปค ์‹คํ–‰์‹œ -p ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํ†ตํ•ด ์ปจํ…Œ์ด๋„ˆ์™€ ์™ธ๋ถ€์˜ ํ†ต์‹ ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค

๋„์ปค ํฌํŠธ ๋ฒˆํ˜ธ ์„ค์ •ํ•˜๊ธฐ

๋„์ปค์—์„œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ๊ธฐ๋ณธ ๊ฐ’์œผ๋กœ๋Š” ํฌํŠธ ์ง€์ •์ด ๋˜์–ด์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ž…๋ ฅํ•ด์„œ ์™ธ๋ถ€์™€์˜ ํฌํŠธ ํฌ์›Œ๋”ฉ์„ ์‹œ์ผœ์ค˜์•ผ ํ• ๋•Œ๊ฐ€ ์žˆ๋‹ค. โ€˜-pโ€™ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํฌํŠธ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ๊ฐ€ ์žˆ๋‹ค.

# httpd ์ด๋ฏธ์ง€๋ฅผ apa000ex2๋ผ๋Š” ์ปจํ…Œ์ด๋„ˆ๋กœ ๋ฐฑ๊ทธ๋ผ์šด๋“œ ์‹คํ–‰ํ•˜๊ณ  -p๋ฅผ ํ†ตํ•ด ์ปจํ…Œ์ด๋„ˆ์˜ 80ํฌํŠธ๋ฅผ ์™ธ๋ถ€์˜ 8080์œผ๋กœ ํฌ์›Œ๋”ฉ
docker run --name apa000ex2 -d -p 8080:80 httpd
# ์ปจํ…Œ์ด๋„ˆ ์ •์ง€ํ•˜๊ณ  ์‚ญ์ œํ•˜๊ธฐ
docker stop apa000ex2
docker rm apa000ex2
# ์‚ญ์ œ ํ›„ ์ปจํ…Œ์ด๋„ˆ ๋‚จ์•„์žˆ๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ
docker ps -a


Docker ๊ด€๋ จ ๋ฆฌ์„œ์น˜ํ•œ ๊ฒƒ:

ํƒœ๊ทธ

๊ด€๋ จ๊ธ€ ๋”๋ณด๊ธฐ

๋Œ“๊ธ€ ์˜์—ญ