Dreamhack - Exercise: Docker

์ด์ง€๊ฐยท2024๋…„ 1์›” 6์ผ
1

Dreamhack

๋ชฉ๋ก ๋ณด๊ธฐ
7/9

Dreamhack - Exercise: Docker

๋„์ปค ์„ค์น˜

Install Docker Engine on Ubuntu
๐Ÿ”ผ์œ„ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์„ค์น˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

$ sudo apt-get update
$ sudo apt-get install \
    ca-certificates \
    curl \
    gnupg
$ sudo mkdir -m 0755 -p /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

์ด๋ ‡๊ฒŒ ๋œจ๋ฉด ๋„์ปค ์„ค์น˜ ์„ฑ๊ณต!




Exercise: Docker


์ด๋ฒˆ ๋ฌธ์ œ๋Š” Dockerfile๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋นŒ๋“œํ•˜๊ณ  ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•ด ๋ณด๊ธฐ ์œ„ํ•œ ์‹ค์Šต ๋ฌธ์ œ!!!


๋ฌธ์ œ ํŒŒ์ผ์„ ๋‹ค์šด ๋ฐ›์€ ๋’ค ๋ฆฌ๋ˆ…์ŠคVM์œผ๋กœ ์˜ฎ๊ฒจ์ค€๋‹ค.

Dockerfile์ด ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ์—์„œ





๋„์ปค ๋นŒ๋“œ๋ฅผ ํ•˜๋ฉด ๊ถŒํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋œฌ๋‹ค.

sudo usermod -aG docker $USER: ๋„์ปค๊ทธ๋ฃน์— ํ˜„์žฌ์‚ฌ์šฉ์ž๋ฅผ ์ถ”๊ฐ€
newgrp docker: ๊ทธ๋ฃน ์ถ”๊ฐ€๋ฅผ ํ˜„์žฌ ์ฝ˜์†”์— ๋ฐ˜์˜

์œ„ ๋ช…๋ น์–ด๋ฅผ ์ณ์ค€๋’ค ๋‹ค์‹œ ๋„์ปค ๋นŒ๋“œ๋ฅผ ํ•ด์ค€๋‹ค (๋งŒ์•ฝ ๋นŒ๋“œ ์ค‘ ์•ˆํ’€๋ฆฌ๋Š” ์˜ค๋ฅ˜๊ฐ€ ์žˆ๋‹ค๋ฉด ์šฐ๋ถ„ํˆฌ๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ•˜๋Š” ๊ฒƒ๋„ ์ข‹์€ ๋ฐฉ๋ฒ•... ๋ฉฐ์น ๋™์•ˆ ์•ˆํ’€๋ฆฌ๋˜ ๋นŒ๋“œ์˜ค๋ฅ˜๊ฐ€ ์žฌ์„ค์น˜๋ฅผ ํ•˜๋‹ˆ ํ•ด๊ฒฐ๋˜์—ˆ๋‹ค.)


docker images: ๋„์ปค ์ด๋ฏธ์ง€ ๋ชฉ๋ก์„ ์ถœ๋ ฅ
none์ด๋ผ๋Š” ์ƒˆ๋กœ์ƒ๊ธด ๋„์ปค ์ด๋ฏธ์ง€๊ฐ€ ๋ณด์ธ๋‹ค.

docker run -it [image id] /bin/bashย :ย ์ด๋ฏธ์ง€๋กœ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์‹คํ–‰ํ•˜์—ฌ bash ์…ธ ์—ด๊ธฐ

ls๋กœ ๋ณด๋ฉด flag ํŒŒ์ผ์ด ๋ณด์ธ๋‹ค.
cat flag ํ•˜์—ฌ flag๋ฅผ ์–ป์–ด์ค€๋‹ค.

flag: DH{docker_exercise}





ํ’€์ด ํŒ: Docker

profile
์ •๋ณด๋ณด์•ˆํ•™๊ณผ์ƒ

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