๐Ÿค ์€์ง€log ๐Ÿค

[CI/CD study] - 13. Docker-Compose ์™€ Nginx ์„ค์น˜ ๋ณธ๋ฌธ

๐Ÿ’š DevOps

[CI/CD study] - 13. Docker-Compose ์™€ Nginx ์„ค์น˜

Eun_zii 2022. 10. 19. 22:41
 

Install on Linux

 

docs.docker.com

 

๊ณต์‹ ๋ฌธ์„œ ๋กœ ์„ค์น˜๊ฐ€ ์•ˆ๋ ๊ฒฝ์šฐ

์ฐธ๊ณ  โฌ‡

 

Linux์— Docker Compose ์„ค์น˜

1. ์„ค์น˜ Docker Compose๋Š” ์ž‘์—…์„ ์œ„ํ•ด Docker Engine์„ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ๋กœ์ปฌ ๋˜๋Š” ์›๊ฒฉ์— Docker Engine์ด ์„ค์น˜๋˜์–ด ์žˆ์–ด์•ผ ํ•œ๋‹ค.

dejavuhyo.github.io

 

docker compose :

๋„์ปค ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์–ด์ง„ ์ปจํ…Œ์ด๋„ˆ๋“ค์„ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ• ๋•Œ

์šฐ๋ฆฌ๋Š” ํฌํŠธ๋ผ๋˜์ง€ ์—ฌ๋Ÿฌ ์˜ต์…˜๋“ค์„ ๊ธฐ์–ตํ•˜๊ณ  ์žˆ์–ด์•ผํ–ˆ๊ณ  ๋งŒ์ผ ํ•˜๋‚˜๊ฐ€ ์•„๋‹ˆ๋ผ ์—ฌ๋Ÿฌ ์ปจํ…Œ์ด๋„ˆ๋“ค์„ ๊ด€๋ฆฌ๋ฅผ ํ•ด์•ผ๋œ๋‹ค๊ณ  ํ•˜๋ฉด

์—ฌ๊ฐ„ ๋ถˆํŽธํ•œ์ผ์ด ์•„๋‹ ์ˆ˜ ์—†๋‹ค.

ํ•˜๋‚˜์˜ ์„ค์ •ํŒŒ์ผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก, ์กฐ๊ธˆ ๋” ์‚ฌ์šฉ์ž์—๊ฒŒ ํŽธ๋ฆฌํ•˜๋„๋ก ์ œ๊ณตํ•˜๋Š”๊ฒƒ์ด

docker์˜ ๊ธฐ๋Šฅ ์ค‘ ํ•˜๋‚˜์ธ docker compose ์ด๋‹ค.

 

๐Ÿ‘ฉ‍๐Ÿ’ป ํ•„์ž๋Š” Docker-Compose๋ฅผ AWS ์„œ๋ฒ„์—

deploy์šฉ ์œผ๋กœ ์ธ์Šคํ„ด์Šค๋ฅผ ๋งŒ๋“ค์–ด์„œ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.๐Ÿ‘ฉ‍๐Ÿ’ป

 

 

$ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
$ mkdir -p $DOCKER_CONFIG/cli-plugins
$ curl -SL https://github.com/docker/compose/releases/download/v2.12.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose

 

ํ„ฐ๋ฏธ๋„ ( ๋˜๋Š” SSH Tool) ์— ํ•œ์ค„์”ฉ ์ž…๋ ฅํ•˜๊ธฐ

โŒจ๏ธ DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}

โŒจ๏ธ mkdir -p $DOCKER_CONFIG/cli-plugins

โŒจ๏ธ curl -SL https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose

 

 chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

 

์‹คํ–‰ ๊ถŒํ•œ ๋ถ€์—ฌ

 

$ docker compose version
$ docker-compose version

 

๋„์ปค ์ปดํฌ์ฆˆ ๋ฒ„์ „ ํ™•์ธ

โŒจ๏ธ docker compose version

๋˜๋Š”

โŒจ๏ธ docker-compose version

* ์„ค์น˜๋ฐฉ๋ฒ•์— ๋”ฐ๋ผ ๋„์–ด์“ฐ๊ธฐ๊ฐ€ ์ ์šฉ์ด ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๊ณ 

' - ' ๊ฐ€ ์ ์šฉ๋˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ์œผ๋‹ˆ 

๋ณธ์ธ์ด ์ ์šฉ๋˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ํ•˜๋ฉด๋จ

 

๐ŸŽฃ Docker ๋กœ Nginx ์„ค์น˜

 

Nginx :

๋™์‹œ์ ‘์† ์ฒ˜๋ฆฌ์— ํŠนํ™”๋œ ์›น ์„œ๋ฒ„ ํ”„๋กœ๊ทธ๋žจ์ด๋‹ค.

apache๋ณด๋‹ค ๋™์ž‘์ด ๋‹จ์ˆœํ•˜๊ณ  ์ „๋‹ฌ์ž ์—ญํ• ๋งŒ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋™์‹œ ์ ‘์†์ฒ˜๋ฆฌ์— ํŠนํ™”๋˜์–ด์žˆ๋‹ค.

 

docker pull nginx

 

Docker ์— Nginx ์ด๋ฏธ์ง€ ๋‹ค์šด๋ฐ›๊ธฐ

 

docker run -d -p 80:80 --name nginx nginx

 

์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰ 

* โŒจ๏ธ docker ps 

๋กœ ์ด๋ฏธ์ง€ ์‹คํ–‰ ํ™•์ธ

 

 

ํ•ด๋‹น ์„œ๋ฒ„ ( ๋‚˜๊ฐ™์€ ๊ฒฝ์šฐ๋Š” AWS deploy์šฉ ์ธ์Šคํ„ด์Šค์— ํผ๋ธ”๋ฆญIPv4 ๋กœ 

์›น๋ธŒ๋ผ์šฐ์ €์— ์ ‘์†ํ•˜๋ฉด 

Welcome to nginx! ํŽ˜์ด์ง€๊ฐ€ ๋‚˜์˜จ๋‹ค โญ๏ธ

* AWS ์„œ๋ฒ„ ์‚ฌ์šฉ์‹œ ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™์— 80ํฌํŠธ ์ถ”๊ฐ€ํ•ด์ค˜์•ผํ•จ

 

 

 

โค๏ธ ๋„์›€์ฃผ์‹ ๋ถ„ :

https://m.blog.naver.com/PostView.naver?blogId=suyoungpk&logNo=222899924119&navType=by

728x90