docker container

0. ์ปจํ…Œ์ด๋„ˆ

  • ๋ฌด์–ธ๊ฐ€์˜ ๋ผ์ดํ”„์‚ฌ์ดํด์„ ๊ด€๋ฆฌํ•œ๋‹ค. ์ด๋•Œ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ๊ฒƒ์€ ๊ฒฉ๋ฆฌ!

  • ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์˜ ๋Œ€์ƒ์€ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์„ธ์ƒ์˜ ์ „๋ถ€๋ผ๊ณ  ์ƒ๊ฐํ•œ๋‹ค. (๊ฒฉ๋ฆฌ๋˜์–ด์žˆ์œผ๋‹ˆ๊นŒ)

  • ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹์€ ์ 

    • ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์— ๋ฌด์—‡์ด ์žˆ๋“ ์ง€ ๊ฐ„์— ์ปจํ…Œ์ด๋„ˆ ๋‹จ์œ„๋กœ ์‚ฌ๊ณ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

  • ์ปจํ…Œ์ด๋„ˆ๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ƒ์„ฑ๋˜๊ณ  ์šด์˜๋˜๊ณ  ์ œ๊ฑฐ๋˜๊ธฐ๊นŒ์ง€์˜ ์ƒ์• ์ฃผ๊ธฐ๋ฅผ ๊ด€๋ฆฌํ•˜๋ฉฐ ์ด๋•Œ ์ค‘์š”ํ•œ ๊ฒƒ์€ ๊ฒฉ๋ฆฌ์ด๋‹ค.

  • ์ปจํ…Œ์ด๋„ˆ์˜ ํ”„๋กœ์„ธ์Šค๋Š” ์ œํ•œ๋œ ์ž์› ๋‚ด์—์„œ ์ œํ•œ๋œ ์‚ฌ์šฉ์ž๋งŒ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

1. ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ•™์Šตํ•ด์•ผํ•˜๋Š” ์ด์œ 

  • ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ๋ฐฐํฌ๋˜๋Š” ํ™˜๊ฒฝ์„ ์„œ๋ฒ„์— ์ง์ ‘ ์„ค์น˜ํ•˜์—ฌ ๊ตฌ์„ฑํ•  ๊ฒฝ์šฐ, snowflake server ์ด์Šˆ์— ์ง๋ฉดํ•œ๋‹ค.

  • ์„œ๋น„์Šค๋Š” ์ ์ฐจ ํ™•์žฅ๋˜๊ณ , ๊ธฐ์กด์— ์‚ฌ์šฉํ•˜๋˜ ์„œ๋ฒ„์™€ ์ƒˆ๋กœ ๊ตฌ์ถ•ํ•œ ์„œ๋ฒ„ ๊ฐ„์˜ ์„ค์ • ์ฐจ์ด๊ฐ€ ๋ฐœ์ƒํ•˜๊ฒŒ ๋˜๊ณ , ๊ด€๋ฆฌ์ž์˜ ์ธ์  ์š”์†Œ์—๋„ ์˜ํ–ฅ์„ ๋ฐ›๊ฒŒ ๋œ๋‹ค.

  • ๊ธฐ์กด์—๋Š” ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ํ†ตํ•œ ์ž๋™ํ™” ๋ฐฉ์‹, kickstart ๋“ฑ์„ ๊ฑฐ์ณ์„œ OS ๊ฐ€์ƒํ™” ๋ฐฉ์‹๊นŒ์ง€ ๋‹ค์–‘ํ•œ ํ˜•ํƒœ๋กœ ์„œ๋ฒ„๋ฅผ ๊ด€๋ฆฌํ•ด์™”๋‹ค.

1-1. ๊ธฐ์กด์˜ OS ๊ฐ€์ƒํ™” ๋ฐฉ์‹

  • ๊ธฐ์กด์˜ OS ๊ฐ€์ƒํ™” ๊ธฐ์ˆ ์€ ํ•˜์ดํผ๋ฐ”์ด์ € ๊ธฐ์ˆ ์„ ์ด์šฉํ•ด์„œ ์—ฌ๋Ÿฌ๊ฐœ์˜ ์šด์˜์ฒด์ œ๋ฅผ ํ•˜๋‚˜์˜ ํ˜ธ์ŠคํŠธ์—์„œ ์ƒ์„ฑํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค.

    • ํ•˜์ด๋ฒ„๋ฐ”์ด์ € : ํ˜ธ์ŠคํŠธ ์ปดํ“จํ„ฐ์—์„œ ๋‹ค์ˆ˜์˜ ์šด์˜์ฒด์ œ๋ฅผ ๋™์‹œ์— ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ๋…ผ๋ฆฌ์  ํ”Œ๋žซํผ

  • ๊ฐ์ข… ์‹œ์Šคํ…œ ์ž์›์„ ๊ฐ€์ƒํ™”ํ•˜๊ณ , ๋…๋ฆฝ๋œ ๊ณต๊ฐ„์„ ์ƒ์„ฑํ•˜๋Š” ์ž‘์—…์€ ๋ฐ˜๋“œ์‹œ ํ•˜์ดํผ๋ฐ”์ด์ €๋ฅผ ๊ฑฐ์น˜๊ธฐ ๋•Œ๋ฌธ์— ์ผ๋ฐ˜ ํ˜ธ์ŠคํŠธ์— ๋น„ํ•ด์„œ ์„ฑ๋Šฅ ์†์‹ค์ด ๋ฐœ์ƒํ•˜๊ฒŒ ๋œ๋‹ค.

  • ๊ฐ€์ƒ๋จธ์‹ ์€ guest OS ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, ์ปค๋„ ๋“ฑ์„ ์ „๋ถ€ ํฌํ•จํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ€์ƒ๋จธ์‹ ์„ ๋ฐฐํฌํ•˜๊ธฐ ์œ„ํ•œ ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์—ˆ์„ ๋•Œ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๊ฐ€ ๋„ˆ๋ฌด ์ปค์ง€๊ฒŒ ๋˜์–ด์„œ ์ด๋ฏธ์ง€๋ฅผ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์œผ๋กœ ๋ฐฐํฌํ•˜๊ธฐ์—๋Š” ๋ฌด๋ฆฌ๊ฐ€ ์žˆ์—ˆ๋‹ค.

1-2. ์ปจํ…Œ์ด๋„ˆ์˜ ๋“ฑ์žฅ

  • ๋‹จ์ˆœํžˆ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋„์šฐ๊ณ  ์‹ถ์—ˆ๋˜ ๊ฒƒ ๋ฟ์ธ๋ฐ, OS ๊นŒ์ง€ ๋„์›Œ์•ผํ•˜๋Š” ๊ฒƒ์€ ๋„ˆ๋ฌด ๋‚ญ๋น„์ด๋‹ค.

  • ๊ฒฉ๋ฆฌ๋œ CPU, memory, disk, network ๋ฅผ ๊ฐ€์ง„ ๊ณต๊ฐ„์„ ๋งŒ๋“ค๊ณ , ์ด ๊ณต๊ฐ„์—์„œ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰ํ•ด์„œ ์œ ์ €์—๊ฒŒ ์„œ๋น„์Šค ํ•˜๋ ค๋ฉด ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ๊นŒ? ์— ๋Œ€ํ•œ ๊ณ ๋ฏผ๋ถ€ํ„ฐ ์‹œ์ž‘

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

  • ์ด๋ ‡๊ฒŒ ๋˜๋ฉด, ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์—ˆ์„ ๋•Œ, ์ด๋ฏธ์ง€์˜ ์šฉ๋Ÿ‰์€ ๊ฐ€์ƒ๋จธ์‹ ์— ๋น„ํ•ด ํ›จ์”ฌ ์ค„์–ด๋“ค๊ฒŒ ๋œ๋‹ค.

  • ์ปจํ…Œ์ด๋„ˆ์˜ ๋‚ด์šฉ์„ ์ˆ˜์ •ํ•ด๋„ ํ˜ธ์ŠคํŠธ OS ์— ์˜ํ–ฅ์„ ์ „ํ˜€ ๋ฏธ์น˜์ง€ ์•Š๋Š”๋‹ค.

  • ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ฐœ๋ฐœ๊ณผ ๋ฐฐํฌ๊ฐ€ ํŽธํ•ด์ง„๋‹ค.

  • ์—ฌ๋Ÿฌ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋…๋ฆฝ์„ฑ๊ณผ ํ™•์žฅ์„ฑ์ด ๋†’์•„์ง„๋‹ค.

2. ์ปจํ…Œ์ด๋„ˆ์˜ ํ”„๋กœ์„ธ์Šค ์ถ”์ƒํ™”

2-1. ๋„์ปค ์„ค์น˜

$ sudo apt-get update && \
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
sudo apt-key fingerprint 0EBFCD88 && \
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
sudo apt-get update && \
sudo apt-get install -y docker-ce && \
sudo usermod -aG docker ubuntu && \
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
sudo chmod +x /usr/local/bin/docker-compose && \
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

2-2. ๋„์ปค ๋ฐ๋ชฌ

  • ์‚ฌ์šฉ์ž๊ฐ€ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด, docker.sock ์„ ํ†ตํ•ด์„œ ๋„์ปค ๋ฐ๋ชฌ์˜ API ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

  • ๋„์ปค ๋ฐ๋ชฌ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ๋Š” docker events ๋ฅผ ํ†ตํ•ด์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•˜๋‹ค.

  • ์ถ”๊ฐ€์ ์œผ๋กœ, docker stats ์™€ docker system df ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด์„œ ๋„์ปค๊ฐ€ ํ˜„์žฌ host ์˜ ์ž์›์„ ์–ผ๋งˆ๋‚˜ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

## docker ๋ช…๋ น์–ด๊ฐ€ dockerd๋ผ๋Š” ๋„์ปค ๋ฐ๋ชฌ๊ณผ docker.sock์„ ์ฐธ์กฐํ•˜๊ณ  ์žˆ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
$ sudo lsof -c docker
dockerd     880 root  txt       REG              202,1 102066512      55737 /usr/bin/dockerd
dockerd     880 root    6u     unix 0xffff953085804400       0t0      18324 /var/run/docker.sock type=STREAM

$ sudo docker run -it ubuntu:latest bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
3ff22d22a855: Pull complete
e7cb79d19722: Pull complete
323d0d660b6a: Pull complete
b7f616834fd0: Pull complete
Digest: sha256:5d1d5407f353843ecf8b16524bc5565aa332e9e6a1297c73a92d3e754b8a636d
Status: Downloaded newer image for ubuntu:latest
root@b7345bbb0ec1:/#

$ sudo docker events
2020-08-16T05:47:10.885807752Z image pull ubuntu:latest (name=ubuntu)
2020-08-16T05:47:11.247030355Z container create b7345bbb0ec1fae4b183c0fe1947a70a3045ba8d75f74876a812a37c40921707 (image=ubuntu:latest, name=awesome_ishizaka)
2020-08-16T05:47:11.249065810Z container attach b7345bbb0ec1fae4b183c0fe1947a70a3045ba8d75f74876a812a37c40921707 (image=ubuntu:latest, name=awesome_ishizaka)
2020-08-16T05:47:11.278151263Z network connect 6b6ce553a425c9392c5a65b8dcd2a57e1665289354b97f430758b745b1dc86a7 (container=b7345bbb0ec1fae4b183c0fe1947a70a3045ba8d75f74876a812a37c40921707, name=bridge, type=bridge)
2020-08-16T05:47:11.529841638Z container start b7345bbb0ec1fae4b183c0fe1947a70a3045ba8d75f74876a812a37c40921707 (image=ubuntu:latest, name=awesome_ishizaka)
2020-08-16T05:47:11.531931004Z container resize b7345bbb0ec1fae4b183c0fe1947a70a3045ba8d75f74876a812a37c40921707 (height=25, image=ubuntu:latest, name=awesome_ishizaka, width=167)

2-3. ๋„์ปค ์ปจํ…Œ์ด๋„ˆ

  • ๋„์ปค ์ปจํ…Œ์ด๋„ˆ๋Š” ํ˜ธ์ŠคํŠธ ์‹œ์Šคํ…œ์˜ ์ปค๋„์„ ๊ณต์œ ํ•œ๋‹ค.

$ docker run -it ubuntu:latest bash
root@03d7ffae4c3c:/# uname -a
Linux 03d7ffae4c3c 5.3.0-1032-aws #34~18.04.2-Ubuntu SMP Fri Jul 24 10:06:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ docker run -it centos:latest bash
[root@6ec49524540c /]# uname -a
Linux 6ec49524540c 5.3.0-1032-aws #34~18.04.2-Ubuntu SMP Fri Jul 24 10:06:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

# ๋งฅOS๋Š” ๋ฆฌ๋ˆ…์Šค๊ฐ€ ์•„๋‹ˆ๋ฏ€๋กœ ๋„ค์ดํ‹ฐ๋ธŒํ•˜๊ฒŒ ๋„์ปค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์–ด, linuxkit ๊ธฐ๋ฐ˜ ๊ฒฝ๋Ÿ‰ ๊ฐ€์ƒ๋จธ์‹  ์œ„์—์„œ ๋„์ปค๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
# ์ดํ›„์˜ ์‹ค์Šต์€ ๋ฆฌ๋ˆ…์Šค์—์„œ ์‹คํ–‰ํ•˜๊ธธ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
โฏ docker run -it centos:latest bash
[root@c3fdb0cda9ac /]# uname -a
Linux c3fdb0cda9ac 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • ์ปจํ…Œ์ด๋„ˆ๋Š” ์ด๋ฏธ์ง€์— ๋”ฐ๋ผ์„œ ์‹คํ–‰๋˜๋Š” ํ™˜๊ฒฝ(ํŒŒ์ผ ์‹œ์Šคํ…œ)์ด ๋‹ฌ๋ผ์ง„๋‹ค.

  • ์ด๊ฒƒ์ด ๊ฐ€๋Šฅํ•œ ์ด์œ ๋Š” chroot ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€(ํŒŒ์ผ์˜ ์ง‘ํ•ฉ)๋ฅผ ๋ฃจํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ์œผ๋กœ ๊ฐ•์ œ๋กœ ์ธ์‹์‹œ์ผœ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

    • ๊ฐ™์€ ํ˜ธ์ŠคํŠธ์˜ ์ปค๋„์„ ์“ฐ๊ณ  ์žˆ์ง€๋งŒ, ์ด๋ฏธ์ง€๋งˆ๋‹ค ๋ฃจํŠธ๋ฅผ ๋‹ค๋ฅด๊ฒŒ ์„ค์ •ํ•˜์—ฌ ์„œ๋กœ ๋‹ค๋ฅธ ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ๊ฒฝํ—˜ํ•  ์ˆ˜ ์žˆ๋‹ค.

# ๋‘˜์˜ ํŒŒ์ผ์‹œ์Šคํ…œ์ด ๋‹ค๋ฅธ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. 

$ docker run -it ubuntu:latest bash
root@03d7ffae4c3c:/# cat /etc/*-release
DISTRIB_ID=Ubuntu

$ docker run -it centos:latest bash
[root@6ec49524540c /]# cat /etc/*-release
CentOS Linux release 8.2.2004 (Core)
  • ์ปจํ…Œ์ด๋„ˆ๋„ ๊ฒฐ๊ตญ์€ ํ”„๋กœ์„ธ์Šค์ด๋‹ค.

## ์šฐ์„ , ํ„ฐ๋ฏธ๋„์˜ PID๋ฅผ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.
$ echo $$
3441
$ sudo ps -ef | grep 3441
ubuntu    3441  3440  0 05:46 pts/2    00:00:00 -bash

## ๊ทธ๋Ÿผ, PID 1์˜ Command๋ฅผ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค.
$ cat /proc/1/comm
systemd
$ pstree -p
systemd(1)โ”€โ”ฌโ”€accounts-daemon(849)โ”€โ”ฌโ”€{accounts-daemon}(859)
...

## ์ด์ œ nginx ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ด๋ด…๋‹ˆ๋‹ค.
$ docker run --name nginx -d -p 80:80 nginx:latest
$ docker exec -it nginx bash
root@acaf67af191e:/# echo $$
324

## nginx ์ปจํ…Œ์ด๋„ˆ์˜ PID 1 ์˜ Command๋Š” nginx์ž„์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 
$ sudo docker exec -it acaf67af191e cat /proc/1/comm
nginx
root@acaf67af191e:/# apt-get update
root@acaf67af191e:/# apt-get install psmisc
root@acaf67af191e:/# pstree -p
nginx(1)--nginx(28)

## ํ•˜์ง€๋งŒ ์‚ฌ์‹ค์€ PID 4453 ํ”„๋กœ์„ธ์Šค์ž„์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 
## ์„œ๋ฒ„์—์„  ๊ทธ์ € nginx ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ•˜๋‚˜ ๋„์›Œ์ ธ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.
$ cat /var/run/docker/runtime-runc/moby/acaf67af191e5165b98b427b851f9b29a1450d20abd4e2e5287463ccc02c24a0/state.json | jq '.init_process_pid'
4453

$ cat /var/run/docker/runtime-runc/moby/acaf67af191e5165b98b427b851f9b29a1450d20abd4e2e5287463ccc02c24a0/state.json | jq '.namespace_paths'
{
  "NEWCGROUP": "/proc/4453/ns/cgroup",
  "NEWIPC": "/proc/4453/ns/ipc",
  "NEWNET": "/proc/4453/ns/net",
  "NEWNS": "/proc/4453/ns/mnt",
  "NEWPID": "/proc/4453/ns/pid",
  "NEWUSER": "/proc/4453/ns/user",
  "NEWUTS": "/proc/4453/ns/uts"
}

$ ls -Al /proc/1/ns | awk '{ print $9 $10 $11 }'
$ ps -ef | grep 4453
$ ps -auxfg
  • ์ปจํ…Œ์ด๋„ˆ์˜ ์‹คํ–‰ํ™˜๊ฒฝ์„ ์ดํ•ดํ•˜๋ฉด ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๊ธฐ๋„ ํ›จ์”ฌ ์ˆ˜์›”ํ•ด์ง„๋‹ค.

    • -i : ํ‘œ์ค€ ์ž…๋ ฅ์„ ๋ฐ›๋„๋ก ์„ค์ •ํ•˜๋Š” ๊ฒƒ. ํŒŒ์ดํ”„๋ผ์ด๋‹์ด๋‚˜ ํ‚ค๋ณด๋“œ ์ž…๋ ฅ ๋“ฑ์„ ๋งํ•œ๋‹ค.

    • -t : ๊ฐ€์ƒ ํ„ฐ๋ฏธ๋„ ์„ค์ •์ด๋‹ค.

    • -it ๊ฐ€ ์กฐํ•ฉ๋˜๋ฉด, ๊ฐ€์ƒ ํ„ฐ๋ฏธ๋„๋กœ ํ‘œ์ค€์ž…๋ ฅ์„ ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, -t ํ•˜๋‚˜๋งŒ ์“ฐ์—ฌ์„œ๋Š” ์•„๋ฌด๋Ÿฐ ์˜๋ฏธ๊ฐ€ ์—†๋‹ค.

      • ํ„ฐ๋ฏธ๋„์€ ์žˆ๋Š”๋ฐ ์ž…๋ ฅ์€ ์•ˆ๋˜๋Š” ์ƒํ™ฉ์ด ๋˜๋ฏ€๋กœ!

      • -i๋Š” ํ™€๋กœ ์“ฐ์—ฌ๋„ ํ„ฐ๋ฏธ๋„ ์—†์ด ๋™์ž‘ํ•˜๋Š” ํŒŒ์ดํ”„๋ผ์ด๋‹ ๋“ฑ์œผ๋กœ ์ž…๋ ฅ์„ ํ•˜๋Š” ๊ธฐ๋Šฅ์— ์“ฐ์ผ ์ˆ˜ ์žˆ๋‹ค.

    • -d : -i, -t ์™€ ํ•จ๊ป˜ ์“ฐ์ผ ์ˆ˜ ์—†๋‹ค. background ์—์„œ ๋Œ์•„๊ฐ€๊ธฐ ๋•Œ๋ฌธ์— -i ๋กœ ์ž…๋ ฅ์„ ๋Œ€๊ธฐํ• ์ˆ˜๋„, -t ๋กœ ๊ฐ€์ƒํ„ฐ๋ฏธ๋„์„ ์ œ๊ณตํ• ์ˆ˜๋„ ์—†๊ธฐ ๋•Œ๋ฌธ!

  • ๋„์ปค ๋ฐ๋ชฌ์€ ํฌ๊ฒŒ ์ปจํ…Œ์ด๋„ˆ, ์ด๋ฏธ์ง€ ๋นŒ๋“œ, ๊ด€๋ฆฌ, ๊ณต์œ , ์‹คํ–‰, ๋ฐ ์ปจํ…Œ์ด๋„ˆ ์ธ์Šคํ„ด์Šค ๊ด€๋ฆฌ ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ํ•œ๋‹ค.

  • ๋ชจ๋“  ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ž์‹ ํ”„๋กœ์„ธ์Šค๋กœ ์†Œ์œ ํ•œ๋‹ค.

3. ๋„์ปค ์ด๋ฏธ์ง€

  • ์ด๋ฏธ์ง€ : ํŒŒ์ผ๋“ค์˜ ์ง‘ํ•ฉ. ์ปจํ…Œ์ด๋„ˆ๋Š” ์ด ํŒŒ์ผ๋“ค์˜ ์ง‘ํ•ฉ ์œ„์—์„œ ์‹คํ–‰๋œ ํŠน๋ณ„ํ•œ ํ”„๋กœ์„ธ์Šค

  • ํ”„๋กœ์„ธ์Šค์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ๋ณ€๊ฒฝ๋˜๋”๋ผ๋„ ์›๋ณธ ํ”„๋กœ๊ทธ๋žจ ์ด๋ฏธ์ง€๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋“ฏ์ด, ์ปจํ…Œ์ด๋„ˆ์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ๋ณ€๊ฒฝ๋˜๋”๋ผ๋„ ์ปจํ…Œ์ด๋„ˆ ์ด๋ฏธ์ง€์˜ ๋‚ด์šฉ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋‹ค.

  • ๋„์ปค ์ด๋ฏธ์ง€๋Š” [์ €์žฅ์†Œ ์ด๋ฆ„]/[์ด๋ฏธ์ง€ ์ด๋ฆ„]:[ํƒœ๊ทธ] ์˜ ํ˜•ํƒœ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค.

## Official ์ด๋ฏธ์ง€๋Š” [์ €์žฅ์†Œ ์ด๋ฆ„]์„ ๋ถ™์—ฌ์ฃผ์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค.
$ docker pull ubuntu:latest
  • ๋„์ปค๋Š” ์—ฌ๋Ÿฌ ๋ ˆ์ด์–ด๋ฅผ ํ•ฉ์ณ์„œ ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ์ด๋ฃฌ๋‹ค.

    • ๋„์ปค๊ฐ€ ๋ช…๋ น์–ด๋กœ commit, pull, push ๋“ฑ์„ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ์ƒ๊ฐํ•ด๋ณธ๋‹ค.

## ubuntu ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ, ์–ด๋–ค ์ˆœ์„œ๋กœ ์ง„ํ–‰ํ–ˆ๋Š”์ง€ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค. 
$ docker history ubuntu
 
## ubuntu ์ด๋ฏธ์ง€๋ฅผ ํ™œ์šฉํ•˜์—ฌ commit_test๋ผ๋Š” ํƒœ๊ทธ๋ฅผ ๋ถ™์ธ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
$ docker run -i -t --name commit_test ubuntu:latest

## ์ปจํ…Œ์ด๋„ˆ ๋‚ด๋ถ€์— ํŒŒ์ผ์„ ํ•˜๋‚˜ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
root@d7c8c6bf4aa4:/# echo test_first! >> first

## ์ปจํ…Œ์ด๋„ˆ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ปค๋ฐ‹ํ•ฉ๋‹ˆ๋‹ค.
$ docker commit \
 -a "woowahancu" -m "my first commit " \
 commit_test \
 commit_test:first

## ์ปค๋ฐ‹ํ•œ ์ปจํ…Œ์ด๋„ˆ ์ด๋ฏธ์ง€๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
$ docker images
 
## ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ํ•˜๋‚˜๋” ์ถ”๊ฐ€ํ•œ ํ›„ ์ปค๋ฐ‹ํ•ฉ๋‹ˆ๋‹ค
$ docker run -i -t --name commit_test2 commit_test:first
 root@07640650696a:/# echo test_second! >> second
 
$ docker commit \
 -a "woowahancu" -m "my second commit " \
 commit_test2 \
 commit_test:second

## ๊ฐ ์ด๋ฏธ์ง€๋“ค์‚ฌ์ด์— ์ถ”๊ฐ€๋œ Layer๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
$ docker inspect ubuntu:latest | jq '.[].RootFS.Layers'
$ docker inspect commit_test:first | jq '.[].RootFS.Layers'
$ docker inspect commit_test:second | jq '.[].RootFS.Layers'
 
$ docker inspect commit_test:first | jq '.[].GraphDriver'
$ docker inspect commit_test:second | jq '.[].GraphDriver'
 
## ์ปค๋ฐ‹ ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ํ™•์ธํ•ด๋ด…๋‹ˆ๋‹ค. 
$ cat /var/lib/docker/overlay2/[์ปจํ…Œ์ด๋„ˆID]/diff/second

4. ๋„์ปค ๋„คํŠธ์›Œํฌ

  • veth interface

    • ๋žœ์นด๋“œ์— ์—ฐ๊ฒฐ๋œ ์‹ค์ œ ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ์•„๋‹ˆ๋ผ ๊ฐ€์ƒ์œผ๋กœ ์ƒ์„ฑํ•œ ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค์ด๋‹ค.

    • ์ผ๋ฐ˜์ ์ธ ๋„คํŠธ์›Œํฌ์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ํŒจํ‚ท์„ ์ „๋‹ฌ๋ฐ›์œผ๋ฉด, ์ž์‹ ์—๊ฒŒ ์—ฐ๊ฒฐ๋œ ๋‹ค๋ฅธ ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ํŒจํ‚ท์„ ๋ณด๋‚ด์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ํ•ญ์ƒ ์Œ์œผ๋กœ ์ƒ์„ฑํ•ด์•ผํ•œ๋‹ค.

  • NET namespace

    • ๋ฆฌ๋ˆ…์Šค์˜ ๊ฒฉ๋ฆฌ ๊ธฐ์ˆ ์ธ namespace ์ค‘ ๋„คํŠธ์›Œํฌ์™€ ๊ด€๋ จ๋œ ๋ถ€๋ถ„์„ ๋งํ•œ๋‹ค.

    • ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ฐ๊ฐ ๋‹ค๋ฅธ namespace ์— ํ• ๋‹นํ•จ์œผ๋กœ์จ ์„œ๋กœ๊ฐ€ ์„œ๋กœ๋ฅผ ๋ชจ๋ฅด๊ฒŒ๋” ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

  • ๋„์ปค ๋„คํŠธ์›Œํฌ ๊ตฌ์กฐ

    • ์œ„์˜ ๋‘ ๊ฐ€์ง€ ๊ฐœ๋…์„ ์ด์šฉํ•˜์—ฌ ๋„คํŠธ์›Œํฌ๋ฅผ ๊ตฌ์„ฑํ•œ๋‹ค.

    • mac ์ด๋‚˜ window ๋Š” veth interface ๊ฐ€ VM ์•ˆ์— ๊ฐ์ถฐ์ ธ์žˆ์–ด์„œ ํ™•์ธํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต๋‹ค.

  1. ์ปจํ…Œ์ด๋„ˆ๋Š” namespace ๋กœ ๊ฒฉ๋ฆฌ๋˜๊ณ , ํ†ต์‹ ์„ ์œ„ํ•œ ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค eth0์„ ํ• ๋‹น๋ฐ›๋Š”๋‹ค. (ํŒŒ๋ž€๋ถ€๋ถ„)

  2. ํ˜ธ์ŠคํŠธOS ์˜ veth interface๊ฐ€ ์ƒ์„ฑ๋˜๊ณ , ์ปจํ…Œ์ด๋„ˆ ๋‚ด์˜ eth0 ๊ณผ ์—ฐ๊ฒฐ๋œ๋‹ค.

  3. host ์˜ veth interface ๋Š” docker0๋ผ๋Š” ๋‹ค๋ฅธ veth interface ์™€ ์—ฐ๊ฒฐ๋œ๋‹ค.

    1. docker 0 ๋Š” ๋„์ปค ์‹คํ–‰์‹œ์— ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” ๊ฐ€์ƒ์˜ ๋ธŒ๋ฆฟ์ง€์ด๋‹ค.

    2. ๋ชจ๋“  ์ปจํ…Œ์ด๋„ˆ๋Š” ์ด ๋ธŒ๋ฆฟ์ง€๋ฅผ ํ†ตํ•ด์„œ ์„œ๋กœ ํ†ต์‹ ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

    3. Switch ์˜ ๋™์ž‘๋ฐฉ์‹์„ ์ฐธ๊ณ ํ•œ๋‹ค.

## ๋„์ปค๋ฅผ ์ƒ์„ฑํ•˜๋ฉด 3๊ฐ€์ง€ ํ˜•ํƒœ์˜ network๊ฐ€ ์ƒ๊น€์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
$ sudo docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
6b6ce553a425        bridge              bridge              local
81a18bc9cc40        host                host                local
576b0223f9cf        none                null                local

## bridge ๋„คํŠธ์›Œํฌ๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด 172.17.0.0/16 ๋Œ€์—ญ์„ ํ• ๋‹นํ–ˆ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
$ docker network inspect bridge
[
    {
        "Name": "bridge",
        "Id": "6b6ce553a425c9392c5a65b8dcd2a57e1665289354b97f430758b745b1dc86a7",
        ...
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"

## ๊ทธ๋ฆฌ๊ณ  172.17.0.0/16 ๋Œ€์—ญ์€ docker0๋กœ ๋งคํ•‘๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
$ ip route
default via 192.168.0.193 dev eth0 proto dhcp src 192.168.0.207 metric 100
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1

## docker0๋Š” veth interface์™€ ๋งคํ•‘๋œ ๋ธŒ๋ฆฟ์ง€์ž„์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
$ brctl show docker0
bridge name	bridge id		STP enabled	interfaces
docker0		8000.024238d4b0f5	no		vethc8e309f

$ ip link ls
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
66: vethc8e309f@if65: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP mode DEFAULT group default
  • docker-compose ๋กœ ๋„์šฐ๋ฉด, ๋‹ค๋ฅธ ๋„คํŠธ์›Œํฌ ๋Œ€์—ญ์„ ๊ฐ€์ง„๋‹ค. compose ๋กœ ๋ฌถ์€ ๋ฒ”์œ„์— ๋งž์ถฐ์„œ ๋ธŒ๋ฆฟ์ง€๋ฅผ ํ•˜๋‚˜ ๋” ์ƒ์„ฑํ•˜๊ธฐ ๋•Œ๋ฌธ!

    • ์„œ๋กœ ๊ณต์œ ํ•˜๋Š” ๋ธŒ๋ฆฟ์ง€๊ฐ€ ๋‹ค๋ฅด๋ฏ€๋กœ, docker-compose ๋กœ ๋„์šด ์ปจํ…Œ์ด๋„ˆ์™€ ์ผ๋ฐ˜ ์ปจํ…Œ์ด๋„ˆ๋Š” ์„œ๋กœ ํ†ต์‹ ํ•  ์ˆ˜ ์—†๋‹ค.

$ git clone https://github.com/woowacourse/service-practice.git
$ cd lb 
$ docker build -t node-server .
$ docker-compose -p practice up -d

$ sudo docker container inspect practice_lb_1 | jq '.[].NetworkSettings.Networks.practice_default.Gateway'
"172.18.0.1"

$ ip route
172.18.0.0/16 dev br-754310d33f5c proto kernel scope link src 172.18.0.1

$ ip link ls
4: br-754310d33f5c: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
   link/ether 02:42:cd:76:d1:f1 brd ff:ff:ff:ff:ff:ff
  • ๊ธฐ๋ณธ์ ์œผ๋กœ ์ปจํ…Œ์ด๋„ˆ๋Š” ์™ธ๋ถ€์™€ ํ†ต์‹ ์ด ๋ถˆ๊ฐ€ํ•˜๋‹ค. ํฌํŠธํฌ์›Œ๋”ฉ์„ ์„ค์ •ํ•˜์—ฌ ์™ธ๋ถ€์— ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ณต๊ฐœํ•  ์ˆ˜ ์žˆ๋‹ค.

# ํฌํŠธํฌ์›Œ๋”ฉ ์„ค์ •๊ณผ ํ•จ๊ป˜ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
$ docker container run -d -p 8081:80 nginx
16cd67c48e5721a6b666192b8960875c720168bf6c5e3ed2138fb04c492447c6

$ sudo docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
16cd67c48e57        nginx               "/docker-entrypoint.โ€ฆ"   4 seconds ago       Up 3 seconds        0.0.0.0:8081->80/tcp   trusting_bhabha

# Host์˜ 8081ํฌํŠธ๊ฐ€ listen ์ž„์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
$ sudo netstat -nlp | grep 8081
tcp6       0      0 :::8081                 :::*                    LISTEN      10009/docker-proxy

# docker-proxy ๋ผ๋Š” ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ•ด๋‹น ํฌํŠธ๋ฅผ listen ํ•˜๊ณ  ์žˆ์Œ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 
# docker-proxy๋Š” ๋“ค์–ด์˜จ ์š”์ฒญ์„ ํ•ด๋‹นํ•˜๋Š” ์ปจํ…Œ์ด๋„ˆ๋กœ ๋„˜๊ธฐ๋Š” ์—ญํ• ๋งŒ์„ ์ˆ˜ํ–‰ํ•˜๋Š” ํ”„๋กœ์„ธ์Šค์ž…๋‹ˆ๋‹ค. 
# ์ปจํ…Œ์ด๋„ˆ์— ํฌํŠธํฌ์›Œ๋”ฉ์ด๋‚˜ expose๋ฅผ ์„ค์ •ํ–ˆ์„ ๊ฒฝ์šฐ ๊ฐ™์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

$ iptables -t nat -L -n
Chain DOCKER (2 references)
target     prot opt source               destination
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
RETURN     all  --  0.0.0.0/0            0.0.0.0/0
DNAT       tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:8081 to:172.17.0.2:80

# ๋ณด์‹œ๋‹ค์‹œํ”ผ ๋ชจ๋“  ์š”์ฒญ์„ DOCKER Chain ์œผ๋กœ ๋„˜๊ธฐ๊ณ , DOCKER Chain ์—์„œ๋Š” DNAT๋ฅผ ํ†ตํ•ด ํฌํŠธํฌ์›Œ๋”ฉ์„ ํ•ด์ฃผ๊ณ  ์žˆ์Œ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
# ์ด iptables ๋ฃฐ์€ docker daemon์ด ์ž๋™์œผ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  • docker container ์˜ ๋„คํŠธ์›Œํฌ ๋ชจ๋“œ๋Š” bridge, host, container, none ๋“ฑ ์ด 4๊ฐœ๊ฐ€ ์กด์žฌํ•œ๋‹ค.

5. ๋„์ปค ๋ณผ๋ฅจ

  • ๋„์ปค ์ด๋ฏธ์ง€๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด, ์ด๋ฏธ์ง€๋Š” ์ฝ๊ธฐ ์ „์šฉ์ด ๋œ๋‹ค.

  • ์ปจํ…Œ์ด๋„ˆ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ๋งŒ ๋ณ„๋„ ์ €์žฅํ•ด์„œ ๊ฐ ์ปจํ…Œ์ด๋„ˆ์˜ ์ •๋ณด๋ฅผ ๋ณด์กดํ•œ๋‹ค.

  • ํ•˜์ง€๋งŒ mysql ๊ณผ ๊ฐ™์ด ์ปจํ…Œ์ด๋„ˆ ๊ณ„์ธต์— ์ €์žฅ๋˜์–ด์žˆ๋˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์ •๋ณด๋ฅผ ์‚ญ์ œํ•ด์„œ๋Š” ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์„ ๊ฒƒ์ด๋‹ค. ์ปจํ…Œ์ด๋„ˆ ๋ฐ์ดํ„ฐ๋ฅผ ์˜์†์ ์ธ ๋ฐ์ดํ„ฐ๋กœ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ• ์ค‘, ๋ณผ๋ฅจ์„ ํ™œ์šฉํ•˜๋Š” ๋ฐฉ์•ˆ์ด ์žˆ๋‹ค.

  • -v ์˜ต์…˜ : ํ˜ธ์ŠคํŠธ์˜ ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์ปจํ…Œ์ด๋„ˆ์˜ ๋””๋ ‰ํ„ฐ๋ฆฌ์— ๋งˆ์šดํŠธํ•˜๋‚˜. ๋”ฐ๋ผ์„œ ์ปจํ…Œ์ด๋„ˆ์˜ ํ•ด๋‹น ๊ฒฝ๋กœ์— ํŒŒ์ผ์ด ์žˆ์—ˆ๋‹ค๋ฉด, ํ˜ธ์ŠคํŠธ์˜ ๋ณผ๋ฅจ์œผ๋กœ ๋ฎ์–ด ์”Œ์›Œ์ง„๋‹ค.

$ docker run -d \
--name wordpressdb_hostvolume \
-e MYSQL_ROOT_PASSWORD=password \
-e MYSQL_DATABAS=wordpress \
-v /home/wordpress_db:/var/lib/mysql \
mysql:5.7

$ docker run -d \
--name wordpress_hostvolume \
-e MYSQL_ROOT_PASSWORD=password \
--link wordpressdb_hostvolume:mysql \
-p 80 \
wordpress

$ ls /home/wordpress_db
$ docker stop wordpressdb_hostvolume wordpress_hostvolume
$ docker rm wordpressdb_hostvolume wordpress_hostvolume

์ด๋ ‡๊ฒŒ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์•„๋‹Œ ์™ธ๋ถ€์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ , ์ปจํ…Œ์ด๋„ˆ๋Š” ๊ทธ ๋ฐ์ดํ„ฐ๋กœ ๋™์ž‘ํ•˜๋„๋ก stateless ํ•˜๊ฒŒ ์„ค๊ณ„ํ•˜์—ฌ์•ผ ํ•œ๋‹ค. ์ปจํ…Œ์ด๋„ˆ ์ž์ฒด๋Š” ์ƒํƒœ๊ฐ€ ์—†๊ณ , ์ƒํƒœ๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋Š” ์™ธ๋ถ€๋กœ๋ถ€ํ„ฐ ์ œ๊ณต๋ฐ›๋„๋ก ํ•œ๋‹ค.

Last updated