๋ฐ์ํ
๋์ปค ๋ฒ์ ํ์ธ(docker version)
docker version # Show the Docker version information
๋์ปค ์์ธ์ ๋ณด ํ์ธ(docker inspect)
docker inspect [OPTIONS] NAME|ID [NAME|ID...] # Return low-level information
์ปจํ ์ด๋ ์์ฑ ๋ฐ ์คํ(docker container run)
docker container run [OPTIONS] IMAGE [COMMAND] [ARG...] # Run a command in a new container # -d, --detach : ์ปจํ ์ด๋๋ฅผ ๋ฐฑ๊ทธ๋ผ์ด๋๋ก ์คํํ๊ณ , ์ปจํ ์ด๋ ID๋ฅผ ์ถ๋ ฅํฉ๋๋ค. # -p, --publish list : ํธ์คํธ์ ํฌํธ์ ์ปจํ ์ด๋์ ํฌํธ๋ฅผ ๋ฐ์ธ๋ฉํฉ๋๋ค. ํธ์คํธ ํฌํธ:์ปจํ ์ด๋ ํฌํธ # --name string : ์ปจํ ์ด๋์ ์ด๋ฆ์ ํ ๋นํฉ๋๋ค. # ex) ์ต์ nginx ์ด๋ฏธ์ง๋ก ์ปจํ ์ด๋๋ฅผ ๋์๋๋ค. ์ด๋ฆ์ test_nginx์ด๊ณ , ํธ์คํธ 1234ํฌํธ์ ์ปจํ ์ด๋ 80ํฌํธ๋ฅผ ๋ฐ์ธ๋ฉํฉ๋๋ค. docker container run -d -p 1234:80 --name test_nginx nginx:latest
์ปจํ ์ด๋ ์์ฑ(docker container create)
docker container create [OPTIONS] IMAGE [COMMAND] [ARG...] # Create a new container
์ปจํ ์ด๋ ์คํ ์ค๋จ(docker container stop)
docker container stop [OPTIONS] CONTAINER [CONTAINER...] # Stop one or more running containers
์ค๋จ๋ ์ปจํ ์ด๋ ์คํ(docker container start)
docker container start [OPTIONS] CONTAINER [CONTAINER...] # Start one or more stopped containers
๋์ปค ์ปจํ ์ด๋ ๋ฆฌ์คํธ ํ์ธ(docker container ps)
docker container ps [OPTIONS] # List containers # -a, --all : ๋ชจ๋ ์ปจํ ์ด๋ ์ถ๋ ฅ, ๊ธฐ๋ณธ์ ์คํ ์ค์ธ ์ปจํ ์ด๋๋ง ์ถ๋ ฅ # ex) ๋ชจ๋ ์ปจํ ์ด๋ ๋ฆฌ์คํธ ์ถ๋ ฅ docker container ps -a
๋์ปค ์ปจํ ์ด๋ ๋ก๊ทธ ํ์ธ(docker container logs)
docker container logs [OPTIONS] CONTAINER # Fetch the logs of a container # -f, --follow : Follow log output (์ค์๊ฐ ๋ก๊ทธ ์ถ๋ ฅ) # -t, --timestamps : ํ์์คํฌํ ์ถ๋ ฅ # ex) ์ค์๊ฐ์ผ๋ก ํ์์คํฌํ์ ํจ๊ป test_nginx ๋ก๊ทธ๋ฅผ ์ถ๋ ฅํ๋ค docker container logs -tf test_nginx
๋์ปค ์ปจํ ์ด๋ ์ด๋ฆ ๋ณ๊ฒฝ(docker container rename)
docker container rename CONTAINER NEW_NAME # Rename a container
๋์ปค ์ปจํ ์ด๋์์ ํ์ผ ๋ณต์ฌ(docker container cp)
docker container cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- # Copy files/folders between a container and the local filesystem # ex) test_nginx ์ปจํ ์ด๋์ '/usr/share/nginx/html/index.html'๋ฅผ './TEST'๋ก ๋ณต์ฌ docker container cp test_nginx:/usr/share/nginx/html/index.html ./TEST # ex) ํ์ฌ ๋๋ ํฐ๋ฆฌ์ ์๋ 'index.html'๋ฅผ test_nginx ์ปจํ ์ด๋์ '/usr/share/nginx/html/index.html'๋ก ๋ณต์ฌ docker container cp index.html test_nginx:/usr/share/nginx/html/index.html
๋์ปค ์ปจํ ์ด๋์ ๋ช ๋ น(docker container exec)
docker container exec [OPTIONS] CONTAINER COMMAND [ARG...] # Run a command in a running container # -i, --interactive : ํ์ค ์ ์ถ๋ ฅ ์ฐ๊ฒฐ # -t, --tty : ๊ฐ์์ ํฐ๋ฏธ๋ ํ ๋น # ex) test_nginx ์ปจํ ์ด๋์ bash๋ก ์คํ ์ค์ธ ์ปจํ ์ด๋๋ก ์ ์ docker container exec -it test_nginx bash
๋์ปค ์ปจํ ์ด๋ ๋ณ๊ฒฝ์ฌํญ ํ์ธ(docker container diff)
docker container diff CONTAINER # Inspect changes to files or directories on a container's filesystem
๋์ปค ์ปจํ ์ด๋ ์ญ์ (docker container rm)
docker container rm [OPTIONS] CONTAINER [CONTAINER...] # Remove one or more containers
์ฐธ๊ณ
๋ฐ์ํ
'๐ Container & K8S > Docker' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Docker] ๋์ปค ๋ณผ๋ฅจ๊ณผ ๋ณผ๋ฅจ ๋ช ๋ น์ด (0) | 2021.09.25 |
---|---|
[Docker] ๋์ปค ๋ ์ง์คํธ๋ฆฌ์ ๋์ปค ํ๋ธ (0) | 2021.09.22 |
[Docker] ๋์ปค ์ด๋ฏธ์ง ๋น๋์ ๋์ปคํ์ผ (0) | 2021.09.05 |
[Docker] ๋์ปค ์ด๋ฏธ์ง ๋ช ๋ น์ด ์ ๋ฆฌ (0) | 2021.08.29 |
[Docker] ๋์ปค๋? ๋์ปค์ ์ปจํ ์ด๋ ์ ๋ฆฌ (0) | 2021.08.22 |