๐Ÿณ Docker-compose ์ฃผ์š” ์ปค๋งจ๋“œ

๊ฐ€์˜ยท2021๋…„ 8์›” 3์ผ
0

๋„์ปค

๋ชฉ๋ก ๋ณด๊ธฐ
1/3

[Docker CE] docker-compose ๊ธฐ๋ณธ ๋ช…๋ น์–ด ์ •๋ฆฌ
๋” ๋ชจ๋ฅด๊ฒ ๋Š” ๊ฒƒ์€ ์—ฌ๊ธฐ์—์„œ ๋ณด์ž.

์šฐ๋ฆฌ ํ”„๋กœ์ ํŠธ์—์„œ

์ž๋™์œผ๋กœ ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ

  1. host์—์„œ ์ด๋ฏธ์ง€ ๋นŒ๋“œ
  2. docker-compose๋กœ
docker-compose up [์˜ต์…˜] [์„œ๋น„์Šค๋ช…]

์ด ๋ช…๋ น์–ด๋Š” ํ•„์š”ํ•œ ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œํ•˜๋Š” ๋ช…๋ น์–ด์•ผ.

docker-compose build

๋งŒ์•ฝ up์„ ํ•˜๋ฉด์„œ Dockerfile์— ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒจ์„œ ๋นŒ๋“œ๋„ ํ•ด์•ผํ•œ๋‹ค๋ฉด ์ด ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋ฉด ๋ผ.

docker-compose up --build

-d

: ์ด ์˜ต์…˜์€ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์‹คํ–‰์‹œ์ผœ์ค€๋‹ค.

If you change a serviceโ€™s Dockerfile or the contents of its build directory, run docker-compose build to rebuild it.


down

docker-compose down

Stops containers and removes containers, networks, volumes, and images created by up.


run ๋ช…๋ น์–ด๋Š” docker-compose up์œผ๋กœ ์ƒ์„ฑ๋œ ์ปจํ…Œ์ด๋„ˆ์—์„œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๊ณ  ์‹ถ์„ ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.

docker-compose run [service name] [command]

ex) docker-compose run redis /bin/bash

0๊ฐœ์˜ ๋Œ“๊ธ€