"Docker run"의 두 판 사이의 차이

 
(사용자 2명의 중간 판 18개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{소문자}}
==개요==
==개요==
;docker run
;docker run
4번째 줄: 5번째 줄:


{{소스헤더|구문}}
{{소스헤더|구문}}
<source lang='bash'>
<syntaxhighlight lang='bash'>
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
</source>
</syntaxhighlight>
{{소스헤더|명령어 예시}}
{{소스헤더|명령어 예시}}
<source lang='bash'>
<syntaxhighlight lang='bash'>
docker run -d --name redisHostPort -p 6379:6379 redis:latest
docker run -d --name redisHostPort -p 6379:6379 redis:latest
</source>
</syntaxhighlight>


==실행예시 1==
==실행예시 1==
<source lang='console'>
<syntaxhighlight lang='console'>
root@default:~# docker run -i -t ubuntu:14.04
root@default:~# docker run -i -t ubuntu:14.04
Unable to find image 'ubuntu:14.04' locally
Unable to find image 'ubuntu:14.04' locally
24번째 줄: 25번째 줄:
Digest: sha256:f6eed4def93a3b54da920737f0abf1a8cae2e480bb368280c898265fcaf910a3
Digest: sha256:f6eed4def93a3b54da920737f0abf1a8cae2e480bb368280c898265fcaf910a3
Status: Downloaded newer image for ubuntu:14.04
Status: Downloaded newer image for ubuntu:14.04
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@0967afc19f46:/# hostname
root@0967afc19f46:/# hostname
0967afc19f46
0967afc19f46
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@0967afc19f46:/# exit
root@0967afc19f46:/# exit
exit
exit
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@default:~#  
root@default:~#  
</source>
</syntaxhighlight>


==실행예시 2==
==실행예시 2==
<source lang='console'>
<syntaxhighlight lang='console'>
$ docker search redis
$ docker search redis
NAME                              DESCRIPTION                                    STARS              OFFICIAL            AUTOMATED
NAME                              DESCRIPTION                                    STARS              OFFICIAL            AUTOMATED
47번째 줄: 48번째 줄:
... (생략)
... (생략)
xetamus/redis-resource            forked redis-resource                          0                                      [OK]
xetamus/redis-resource            forked redis-resource                          0                                      [OK]
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
$ docker run -d redis
$ docker run -d redis
77f5be204ed82b399cefadc154b682dcffe61c3eb9ca118008eded4285ebbaeb
77f5be204ed82b399cefadc154b682dcffe61c3eb9ca118008eded4285ebbaeb
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
$ docker ps
$ docker ps
CONTAINER ID        IMAGE              COMMAND                  CREATED            STATUS              PORTS              NAMES
CONTAINER ID        IMAGE              COMMAND                  CREATED            STATUS              PORTS              NAMES
77f5be204ed8        redis              "docker-entrypoint.s…"  2 minutes ago      Up 2 minutes        6379/tcp            adoring_curran
77f5be204ed8        redis              "docker-entrypoint.s…"  2 minutes ago      Up 2 minutes        6379/tcp            adoring_curran
</source>
</syntaxhighlight>


==실행예시 3==
==실행예시 3==
<source lang='console'>
<syntaxhighlight lang='console'>
$ docker run -d --name redisHostPort -p 6379:6379 redis:latest
$ docker run -d --name redisHostPort -p 6379:6379 redis:latest
202d4e2003757b4533936b64ef64a72f15d68885e040bf84bf68a86d2cecb8f8
202d4e2003757b4533936b64ef64a72f15d68885e040bf84bf68a86d2cecb8f8
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
$ docker ps -f name=redisHostPort
$ docker ps -f name=redisHostPort
CONTAINER ID        IMAGE              COMMAND                  CREATED            STATUS              PORTS                    NAMES
CONTAINER ID        IMAGE              COMMAND                  CREATED            STATUS              PORTS                    NAMES
202d4e200375        redis:latest        "docker-entrypoint.s…"  3 minutes ago      Up 3 minutes        0.0.0.0:6379->6379/tcp  redisHostPort
202d4e200375        redis:latest        "docker-entrypoint.s…"  3 minutes ago      Up 3 minutes        0.0.0.0:6379->6379/tcp  redisHostPort
</source>
</syntaxhighlight>
 
==주요 옵션==
* [[docker run -d]] (<del>daemon</del> detach)
* [[docker run -p]] (<del>port</del> publish)
* [[docker run -v]] (volume)
* [[docker run -e]] (env)
* <del>[[docker run -i]] (interactive)</del>
* <del>[[docker run -t]] (tty)</del>
* [[docker run -it]] (interactive + tty) ★
* [[docker run --rm]] (remove)
* [[docker run --name]] (name)


==같이 보기==
==같이 보기==
{{z컬럼3|
* [[docker run hello-world]]
* [[docker run hello-world]]
* [[docker run -it ubuntu bash]]
* [[docker run -it ubuntu bash]]
* [[docker run -d]]
* [[docker run --cpus]] - 도커 컨테이너 CPU 제한하기
* [[docker run -d -p]]
* [[docker run --memory]] - 도커 컨테이너 메모리 제한하기
* [[docker run -d -v]]
* [[docker ps]]
* [[docker ps]]
* [[docker logs]]
* [[docker build]]
* [[docker inspect]]
* [[docker inspect]]
* [[docker logs]]
* [[docker 명령어]]
* [[docker 명령어]]
* [[helm install]]
* [[kubectl run]]
* [[podman run]]
* [[alias로 docker run]]
* [[bash 함수로 docker run]]
}}


==참고==
==참고==
* https://docs.docker.com/engine/reference/run/
* https://docs.docker.com/engine/reference/run/
* https://www.lainyzine.com/ko/article/docker-run/


[[분류: docker]]
[[분류: docker run]]

2023년 9월 17일 (일) 03:01 기준 최신판

1 개요[ | ]

docker run
  • 새로운 컨테이너에서 명령 실행
구문
docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]
명령어 예시
docker run -d --name redisHostPort -p 6379:6379 redis:latest

2 실행예시 1[ | ]

root@default:~# docker run -i -t ubuntu:14.04
Unable to find image 'ubuntu:14.04' locally
14.04: Pulling from library/ubuntu
bae382666908: Pull complete 
f1ddd5e846a8: Pull complete 
90d12f864ab9: Pull complete 
a57ea72e3176: Pull complete 
783a14252520: Pull complete 
Digest: sha256:f6eed4def93a3b54da920737f0abf1a8cae2e480bb368280c898265fcaf910a3
Status: Downloaded newer image for ubuntu:14.04
root@0967afc19f46:/# hostname
0967afc19f46
root@0967afc19f46:/# exit
exit
root@default:~#

3 실행예시 2[ | ]

$ docker search redis
NAME                              DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
redis                             Redis is an open source key-value store that…   5960                [OK]
bitnami/redis                     Bitnami Redis Docker Image                      92                                      [OK]
sameersbn/redis                                                                   71                                      [OK]
grokzen/redis-cluster             Redis cluster 3.0, 3.2, 4.0 & 5.0               38
... (생략)
xetamus/redis-resource            forked redis-resource                           0                                       [OK]
$ docker run -d redis
77f5be204ed82b399cefadc154b682dcffe61c3eb9ca118008eded4285ebbaeb
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
77f5be204ed8        redis               "docker-entrypoint.s…"   2 minutes ago       Up 2 minutes        6379/tcp            adoring_curran

4 실행예시 3[ | ]

$ docker run -d --name redisHostPort -p 6379:6379 redis:latest
202d4e2003757b4533936b64ef64a72f15d68885e040bf84bf68a86d2cecb8f8
$ docker ps -f name=redisHostPort
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
202d4e200375        redis:latest        "docker-entrypoint.s…"   3 minutes ago       Up 3 minutes        0.0.0.0:6379->6379/tcp   redisHostPort

5 주요 옵션[ | ]

6 같이 보기[ | ]

7 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}