๐ Docker Engine
: Docker Engine์ ์ปจํ
์ด๋๋ฅผ ๋น๋ํ๊ณ ์คํํ๋ ๋ฐ ์ฌ์ฉ๋๋ ํต์ฌ ๊ธฐ์ ์
๋๋ค. ํด๋ผ์ด์ธํธ-์๋ฒ(Client-Server) ์ํคํ
์ฒ๋ก ๊ตฌ์ฑ๋์ด ์์ผ๋ฉฐ, ์ธ ๊ฐ์ง ์ฃผ์ ๊ตฌ์ฑ ์์๋ก ์ด๋ฃจ์ด์ ธ ์์ต๋๋ค.
๐ Docker Images
: Docker Images๋ ์ปจํ
์ด๋๋ฅผ ๋ง๋ค๊ธฐ ์ํ ์ฝ๊ธฐ ์ ์ฉ ํ
ํ๋ฆฟ์
๋๋ค. ์ด๋ฏธ์ง๋ ์ ํ๋ฆฌ์ผ์ด์
์ ์คํํ๋ ๋ฐ ํ์ํ ๋ชจ๋ ๊ฒ(์ฝ๋, ๋ผ์ด๋ธ๋ฌ๋ฆฌ, ๋ฐํ์ ํ๊ฒฝ, ํ๊ฒฝ ๋ณ์ ๋ฑ)์ ํจํค์งํ ์ํ๋ก, ์ปจํ
์ด๋์ ์ฒญ์ฌ์ง ์ญํ ์ ํฉ๋๋ค.
๐ Docker Containers
: Docker Container๋ Docker ์ด๋ฏธ์ง์ ์ธ์คํด์ค๋ฅผ ์คํํ๋ ๊ฒฝ๋์ ๋
๋ฆฝ์ ์ธ ์คํ ๋จ์์
๋๋ค. ์ปจํ
์ด๋๋ ์ ํ๋ฆฌ์ผ์ด์
๊ณผ ๊ทธ์ ํ์ํ ๋ชจ๋ ๊ฒ(์ฝ๋, ๋ฐํ์, ์์คํ
๋๊ตฌ, ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฑ)์ ํจํค์งํํ์ฌ, ์ด๋ค ํ๊ฒฝ์์๋ ์ผ๊ด๋๊ฒ ์คํ๋ ์ ์๋๋ก ๋ณด์ฅํฉ๋๋ค.
Docker image vs container
Docker ์ด๋ฏธ์ง (๋ถ์ด๋นต ํ):
์ ์ (static): ํ๋ฒ ๋ง๋ค์ด์ง๋ฉด ๋ณํ์ง ์์ต๋๋ค.
์ฝ๊ธฐ ์ ์ฉ(read-only): ํ ์์ฒด๋ฅผ ์์ ํ ์๋ ์์ฃ .
์ฒญ์ฌ์ง: ๋ถ์ด๋นต์ ๋ง๋ค๊ธฐ ์ํ ์ค๊ณ๋์ด์ ํ ํ๋ฆฟ์ ๋๋ค. ์ ํ๋ฆฌ์ผ์ด์ ๊ณผ ๊ทธ์ ํ์ํ ๋ชจ๋ ์ค์ (์ฝ๋, ๋ฐํ์, ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฑ)์ด ์ด ์์ ๋ด๊ฒจ ์์ต๋๋ค.
docker pull ๋๋ docker build ๋ช ๋ น์ด๋ก ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ๊ฑฐ๋ ์ง์ ๋ง๋ค ์ ์์ต๋๋ค.
Docker ์ปจํ ์ด๋ (๋ถ์ด๋นต):
์คํ ๊ฐ๋ฅํ ์ธ์คํด์ค: ๋ถ์ด๋นต ํ์์ ์ฐ์ด๋ธ ์ค์ ๋ถ์ด๋นต์ ๋๋ค.
๋ ๋ฆฝ์ : ์ฌ๋ฌ ๊ฐ์ ๋ถ์ด๋นต์ ๋์์ ๋ง๋ค ์ ์๋ฏ์ด, ํ ์ด๋ฏธ์ง๋ก ์ฌ๋ฌ ๊ฐ์ ์ปจํ ์ด๋๋ฅผ ์คํํ ์ ์์ต๋๋ค. ๊ฐ ์ปจํ ์ด๋๋ ์๋ก ์ํฅ์ ์ฃผ์ง ์๋ ๋ ๋ฆฝ์ ์ธ ํ๊ฒฝ์์ ์คํ๋ฉ๋๋ค.
ํ๋ฐ์ฑ(ephemeral): ๋ถ์ด๋นต์ ๋จน๊ณ ๋๋ฉด ์ฌ๋ผ์ง๋ฏ์ด, ์ปจํ ์ด๋๋ ์ ์งํ๊ฑฐ๋ ์ญ์ ํ๋ฉด ๊ทธ ์์ ์ ์ฅ๋ ๋ฐ์ดํฐ๊ฐ ์ฌ๋ผ์ง๋๋ค. (๊ทธ๋์ ๋ฐ์ดํฐ๋ฅผ ์๊ตฌ์ ์ผ๋ก ์ ์ฅํ๊ธฐ ์ํด ๋ณผ๋ฅจ์ ์ฌ์ฉํฉ๋๋ค.)
๐ Dockerfile
: Dockerfile์ Docker ์ด๋ฏธ์ง๋ฅผ ๋น๋ํ๊ธฐ ์ํ ๋ช
๋ น์ด๋ฅผ ๋ด์ ํ
์คํธ ํ์ผ์
๋๋ค. Docker๋ ์ด Dockerfile์ ๋์ด๋ ์์๋๋ก ๋ช
๋ น์ด๋ฅผ ์คํํ์ฌ ์ต์ข
์ด๋ฏธ์ง๋ฅผ ์์ฑํฉ๋๋ค.
๐ Docker Compose
: Docker Compose๋ ์ฌ๋ฌ ๊ฐ์ ์ปจํ
์ด๋๋ก ๊ตฌ์ฑ๋ ์ ํ๋ฆฌ์ผ์ด์
์ ์ ์ํ๊ณ ์คํํ๊ธฐ ์ํ ๋๊ตฌ์
๋๋ค. YAML ํ์ผ ํ๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ ์ปจํ
์ด๋์ ์ค์ (์ด๋ฏธ์ง, ๋คํธ์ํฌ, ๋ณผ๋ฅจ, ํ๊ฒฝ ๋ณ์ ๋ฑ)์ ์ ์ํ๊ณ , ๋จ์ผ ๋ช
๋ น์ด๋ก ์ ์ฒด ์ ํ๋ฆฌ์ผ์ด์
์ ๋น๋ํ๊ณ ์คํํ ์ ์์ต๋๋ค.
๐ Docker Hub
: Docker Hub๋ ๊ณต๊ฐ Docker ์ด๋ฏธ์ง ๋ ์ง์คํธ๋ฆฌ์
๋๋ค. ๊ฐ๋ฐ์๋ค์ด ๋ง๋ Docker ์ด๋ฏธ์ง๋ฅผ ๊ณต์ ํ๊ณ ์ ์ฅํ๋ ํด๋ผ์ฐ๋ ๊ธฐ๋ฐ ์๋น์ค๋ก, GitHub๊ฐ ์ฝ๋ ์ ์ฅ์ ์ญํ ์ ํ๋ ๊ฒ๊ณผ ์ ์ฌํฉ๋๋ค.
busybox
docker run -it --rm busybox
Docker Commands
docker --version
: Displays the installed Docker version
docker info
: Shows system-wide information about Docker
docker help
: Lists all available Docker commands and options
Image Management
docker images
: Lists all images on the local machine
docker pull [image-name]
: Downloads an image from Docker Hub or another registry
docker build -t [image-name]
: Builds a Docker image using a Dockerfile in the current directory and tags it with a name
docker tag [source-image] [target-image:tag]
docker push [image-name]
docker rmi [image-id]
Container Management
docker ps
: Lists all running containers
docker ps -a
: Lists all containers, including stopped ones
docker rm [container-id/name]
: Remove a Container
docker rm -f [container-id/name]
: Forces the removal of a running container
docker stop [container-id/name]
: Stops a running container
docker start [container-id/name]
: Starts a stopped container
docker restart [container-id/name]
: Restarts a container

Container Interaction
docker exec [container-id/name] [command]
: Runs a command inside a running container
docker attach docker logs [container-id/name]
: Attaches your terminal to a running container's standard input/output.
# Shows logs from a container
docker logs [options] [container-id/name]
-- follow: Streams logs in real-time.
# Forcing Immediate Termination. Sends SIGKILL
docker kill [options] [container-id/name]
--signal, -s: Specifies the signal to send to the container. By default, it uses SIGKILL.