์ƒ์„ธ ์ปจํ…์ธ 

๋ณธ๋ฌธ ์ œ๋ชฉ

[TIL] Docker ๊ธฐ๋ณธ ์‹คํ–‰ ๋ช…๋ น์–ด 221108

CLOUD/Docker

by ์—์Šคํ”„๋ฆฌํ„ฐ 2022. 11. 8. 16:36

๋ณธ๋ฌธ

728x90
๐Ÿ“
๐Ÿ’ก
Today I Learned ์š”์•ฝ (30ํšŒ์ฐจ) - Docker ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์‹คํ–‰, ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ๋‹ค.

docker ์ปจํ…Œ์ด๋„ˆ ์ƒ์„ฑ ๋ฐ ์ •์ง€, ์‚ญ์ œ ๋ช…๋ น์–ด

Docker์—์„œ ๊ฐ€์žฅ ๊ธฐ๋ณธ ๋ช…๋ น์–ด์ธ run, ps, rm์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

  • Docker์—์„œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๊ฒฝ์šฐ run ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค. ์˜ˆ์ œ๋Š” ๊ธฐ์กด์— ๋งŒ๋“ค์–ด์ ธ์žˆ๋Š” httpd ์ด๋ฏธ์ง€๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒƒ์œผ๋กœ ํ•œ๋‹ค. ์—ฌ๊ธฐ์„œ โ€”name์€ ์ปจํ…Œ์ด๋„ˆ ์ด๋ฆ„ ์ง€์ •์„ ๋œปํ•˜๊ณ  -d๋Š” ๋ฐฑ๊ทธ๋ผ์šด๋“œ ์‹คํ–‰์„ ์˜๋ฏธํ•œ๋‹ค
    docker run --name apa000ex1 -d httpd
    
    Unable to find image 'httpd:latest' locally
    latest: Pulling from library/httpd
    e9995326b091: Pull complete
    ee55ccd48c8f: Pull complete
    bc66ebea7efe: Pull complete
    5d0f831d3c0b: Pull complete
    e559e5380898: Pull complete
    Digest: sha256:5fa96551b61359de5dfb7fd8c9e97e4153232eb520a8e883e2f47fc80dbfc33e
    Status: Downloaded newer image for httpd:latest
    926b9dd856b3030ccf29d88a24bdc2e7cedc4d4a8392312d662b11865c568a1e
  • Docker ps ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋œ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ณ  -a๋ฅผ ์“ธ ๊ฒฝ์šฐ ํ˜„์žฌ ๋น„์‹คํ–‰ ์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ๋„ ๋ชจ๋‘ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
    docker ps -a
    CONTAINER ID   IMAGE  COMMAND                  CREATED              STATUS                    PORTS                              NAMES
    926b9dd856b3   httpd  "httpd-foreground"       About a minute ago   Up About a minute         80/tcp                             apa000ex1
  • ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ค‘์ง€ํ•  ๊ฒฝ์šฐ stop ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.
    docker stop apa000ex1
    apa000ex1
  • ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‚ญ์ œํ•  ๊ฒฝ์šฐ rm ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.
    	docker rm apa000ex1
    apa000ex1


docker ๊ด€๋ จ ๋ฆฌ์„œ์น˜ํ•œ ๊ฒƒ:


Uploaded by N2T

ํƒœ๊ทธ

๊ด€๋ จ๊ธ€ ๋”๋ณด๊ธฐ

๋Œ“๊ธ€ ์˜์—ญ