Studying๐Ÿ’จ

[์›ํ‹ฐ๋“œ ๋ฐฑ์—”๋“œ ์ฑŒ๋ฆฐ์ง€] Docker -2

hae02y 2023. 8. 6. 01:39
๋ฐ˜์‘ํ˜•

๋„์ปค ๊ธฐ๋ณธ ์ •๋ฆฌ

Port Forwading & Volume mount

์›น๋ธŒ๋ผ์šฐ์ €๋ฅผ ํ†ตํ•ด http://example.com:80/index.html์„ ์ ‘๊ทผํ•˜๊ฒŒ ๋˜๋ฉด, ์„œ๋ฒ„ host์˜ 80ํฌํŠธ๋กœ ์ ‘๊ทผ์„ ํ•˜๊ฒŒ ๋œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ปจํ…Œ์ด๋„ˆ์˜ 80ํฌํŠธ์™€ ์—ฐ๊ฒฐ์ด๋˜๊ณ  ์›น์„œ๋ฒ„๋ฅผ ํ†ตํ•ด index.html์„ ์‹คํ–‰ํ•˜๊ฒŒ ๋œ๋‹ค.

 

Container LifeCycle

 

DockerFile ๋™์ž‘๋ฐฉ์‹

๋„์ปคํŒŒ์ผ์„ build ํ•˜๊ฒŒ๋˜๋ฉด ์ด๋ฏธ์ง€๋ฅผ ์–ป์„์ˆ˜์žˆ๊ณ  ์ด๋ฅผ Docker Hub๋กœ Pull / Push ํ• ์ˆ˜์žˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด๋ฏธ์ง€๋ฅผ Runํ•˜์—ฌ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

 

Docker Image upload Docker Hub

Docker hub์— ์ด๋ฏธ์ง€๋ฅผ ๋“ฑ๋กํ•˜๋ ค๋ฉด ๊ทœ์น™์„ ์ค€์ˆ˜ํ•ด์•ผ ํ•œ๋‹ค.

[Docker hub ์‚ฌ์šฉ์ž๋ช…]/[์ด๋ฏธ์ง€๋ช…]:[ํƒœ๊ทธ๋ช…]

 

ํƒœ๊ทธ๋ฐฉ๋ฒ•

1. build ์‹œ ํƒœ๊ทธํ•˜๊ธฐ : docker build -t [์ด๋ฏธ์ง€๋ช…] .

2. build ํ›„ ํƒœ๊ทธํ•˜๊ธฐ : docker image tag [์ด๋ฏธ์ง€๋ช…]

 

์—…๋กœ๋“œ

docker push [options] [name]/[:tag]

docker push hae02y/my-image:latest

 

Docker Network

1. ๋„คํŠธ์›Œํฌ ํ™•์ธ

docker network ls

Network Drivers

- bridge : ๊ธฐ๋ณธ ๋„คํŠธ์›Œํฌ ๋“œ๋ผ์ด๋ฒ„, ๋™์ผํ•œ ๋„์ปค ํ˜ธ์ŠคํŠธ์—์„œ ์ปจํ…Œ์ด๋„ˆ๊ฐ„์˜ ํ†ต์‹ ์„ ๋„์™€์ค€๋‹ค.

- host : host์˜ ๋„คํŠธ์›Œํฌ๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•œ๋‹ค.

- overlay : ์„œ๋กœ ๋‹ค๋ฅธ ๋„์ปค ํ˜ธ์ŠคํŠธ์˜ ์ปจํ…Œ์ด๋„ˆ๊ฐ„ ํ†ต์‹ ์„ ๋„์™€์ค€๋‹ค.

 

 

..๋„์ปค ์ปดํฌ์ฆˆ ์ด์–ด์„œ ์ž‘์„ฑ ํ•„์š”... ใ…Žใ…Ž

๋ฐ˜์‘ํ˜•