๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • ์žฅ์›์ต ๊ธฐ์ˆ ๋ธ”๋กœ๊ทธ
๐Ÿคท๐Ÿผ‍โ™€๏ธ Etc.../- linux, aws, docker, k8s

[Docker] ๋„์ปค ๋ช…๋ น์–ด ๋ชจ์Œ

by Wonit 2020. 12. 1.

๋„์ปค ๋ช…๋ น์–ด ๋ชจ์Œ

์ผ๋ฐ˜์  ๋ช…๋ น์–ด

docker ==>
docker -v ==> ๋„์ปค ๋ฒ„์ „ ํ™•์ธ

rm

docker rm ==> ๋„์ปค ์‚ญ์ œ
docker rm -f ==> ์‹คํ–‰์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ ์‚ญ์ œ

stop

docker stop ==> ๋„์ปค ์ค‘๋‹จ.

ps

docker ps ==> ๋„์ปค ํ”„๋กœ์„ธ์Šค ๋ฆฌ์ŠคํŠธ ํ™•์ธ
docker ps -a ==> ๋„์ปค

๋„์ปค ์‹คํ–‰๊ณผ ์ƒ์„ฑ

run

docker run : ๋„์ปค ์‹คํ–‰
docker run -i -t ==> ๋„์ปค๋ฅผ ์ž…์ถœ๋ ฅ ๋ชจ๋“œ์™€ tty ์„œ๋ฒ„๋กœ ์‹คํ–‰
docker run -it --[name] ==> name์— ํ•ด๋‹นํ•˜๋Š” ์ด๋ฆ„์œผ๋กœ ์‹คํ–‰
docker run -d ==> ๋„์ปค๋ฅผ ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ์‹คํ–‰
docker run -p ==> ํ˜ธ์ŠคํŠธ์˜ ํŠน์ • ํฌํŠธ์™€ ๋„์ปค์˜ ํฌํŠธ๋ฅผ ํฌํŠธํฌ์›Œ๋”ฉ
docker run -e ==> ๋„์ปค ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ๊ฐ’ ๋“ฑ๋ก
docker run ... -v [host-share-directory:container-share-directory] ==> ์˜์†์„ฑ์„ ์œ„ํ•œ ๋„์ปค ๋ณผ๋ฅจ์œผ๋กœ ๋„์ปค๊ฐ€ ํ˜ธ์ŠคํŠธ์˜ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ณต์œ ํ•จ.
docker run ... -v [host-dir/fileName:container-dir/fileName] ==> ์˜์†์„ฑ์„ ์œ„ํ•œ ๋„์ปค ๋ณผ๋ฅจ์œผ๋กœ ๋„์ปค๊ฐ€ ํ˜ธ์ŠคํŠธ์˜ ๋‹จ์ผ ํŒŒ์ผ์„ ๊ณต์œ ํ•จ.
docker run ... --volumns-from [containerName] ==> -v ์˜ต์…˜์œผ๋กœ ํ˜ธ์ŠคํŠธ์™€ ๋ณผ๋ฅจ์„ ๊ณต์œ ํ•œ ์ปจํ…Œ์ด๋„ˆ์™€ ์—ฐ๊ฒฐ

create

docker create ==> ๋„์ปค ์ƒ์„ฑ

start

docker start ==> ๋„์ปค ์‹คํ–‰

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

image

docker images ==> ๋„์ปค ์—”์ง„์— ์กด์žฌํ•˜๋Š” ์ด๋ฏธ์ง€ ์ถœ๋ ฅ
docker rmi [OPTION] IMAGE [IMAGE...] ==> ๋„์ปค ์ด๋ฏธ์ง€ ์‚ญ์ œ

rename

docker rename ==> ๋„์ปค ์ด๋ฏธ์ง€ ์ด๋ฆ„ ๋ณ€๊ฒฝ

๋ณผ๋ฅจ

create

docker volume create ==> ๋„์ปค ๋ณผ๋ฅจ์„ ์ƒ์„ฑ
docker volume create --name[name] ==> ๋„์ปค ๋ณผ๋ฅจ์„ name์ด๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ์ƒ์„ฑ

run

docker volumn run -v [volumeName:containerDir] ==> ํ˜ธ์ŠคํŠธ์™€ ๋ณผ๋ฅจ์„ ๊ณต์œ ํ•  ๋•Œ

ls

docker volume ls ==>

inspect

docker inspect ==> ๋„์ปค ๋ณผ๋ฅจ์ด ์–ด๋””์— ์ €์žฅ๋˜์–ด์žˆ๋Š”์ง€ ํ™•์ธ
docker inspect --type [name] ==> name์ด๋ฆ„์˜ ๋ณผ๋ฅจ์„ ๊ฒ€์ƒ‰

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

commit

docker commit -m "[message]" ==> ๋ฉ”์‹œ์ง€๋กœ ์ปจํ…Œ์ด๋ฅผ ์ปค๋ฐ‹ํ•˜์—ฌ ์ด๋ฏธ์ง€ ์ƒ์„ฑ
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]] ==> ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ฆ

rmi

docker rmi [image name] ==> ๋„์ปค ์ด๋ฏธ์ง€ ์ด๋ฆ„์œผ๋กœ ์‚ญ์ œ

save

docker save -o [์ถ”์ถœ ํŒŒ์ผ๋ช…] [์ด๋ฏธ์ง€ ์ด๋ฆ„] ==> ์ด๋ฏธ์ง€ ์ด๋ฆ„์„ ์ถ”์ถœ ํŒŒ์ผ๋ช…์œผ๋กœ ์ด๋ฏธ์ง€ ์ถ”์ถœ

load

docker load -i [์ถ”์ถœ๋œ ํŒŒ์ผ๋ช…] ==> ์ถ”์ถœ๋œ ์ด๋ฏธ์ง€๋ฅผ ๋„์ปค ์—”์ง„์— ์ƒ์„ฑ

export

docker export -o [์ถ”์ถœ ํŒŒ์ผ๋ช…] [์ด๋ฏธ์ง€ ์ด๋ฆ„] ==> ์ด๋ฏธ์ง€ ์ด๋ฆ„์„ ์ถ”์ถœ ํŒŒ์ผ๋ช…์œผ๋กœ ์ด๋ฏธ์ง€ ์ถ”์ถœ

import

docker import [๋กœ๋“œํ•  ํŒŒ์ผ๋ช…] [์ถ”์ถœ๋œ ํŒŒ์ผ๋ช…] ==> ์ถ”์ถœ๋œ ํŒŒ์ผ๋ช…์„ ๋กœ๋“œํ•  ํŒŒ์ผ๋ช…์œผ๋กœ ๋„์ปค ์—”์ง„์— ์ƒ์„ฑ

๋„์ปค ํ—ˆ๋ธŒ

search

docker search ==> ๋„์ปค ํ—ˆ๋ธŒ์—์„œ ์ด๋ฏธ์ง€ ๊ฒ€์ƒ‰

push

docker push dockerhun-name/image-name:tag ===> ์ด๋ฏธ์ง€ ๋„์ปค ํ—ˆ๋ธŒ๋กœ ์—…๋กœ๋“œ

pull

docker pull dockerhun-name/image-name:tag ==> ์ด๋ฏธ์ง€๋ฅผ ๋„์ปค ํ—ˆ๋ธŒ์—์„œ ๋‹ค์šด

tag

docker tag [๊ธฐ์กด ์ด๋ฏธ์ง€ ์ด๋ฆ„] [๋„์ปคํ—ˆ๋ธŒ ์•„์ด๋””/์ƒˆ๋กญ๊ฒŒ ์ƒ์„ฑ๋  ์ด๋ฆ„] ==> ์ƒ์„ฑ๋  ์ด๋ฏธ์ง€ ์ด๋ฆ„์— ํƒœ๊ทธ๋ฅผ ๋ถ™ํž˜(๋„์ปค ํ—ˆ๋ธŒ์— ์˜ฌ๋ฆด ๋•Œ ํ•„์ˆ˜)

๋Œ“๊ธ€