$ docker run -it hello-docker /usr/games/cowsay “Our own message”
이미지 태그 다음에 나오는 인수는
Dockerfile
에서 설정한 기본 명령을 재정의합니다. 이
는 기본 이진 파일에 자체 명령줄 플래그를 지정하는 가장 좋은 방법입니다. 다음 플래그들도
docker
run
에 유용합니다.
●
-it
‘
interactive
(대화형)’와
tty
의 약자로, 쉘에서 실행 중인 명령과 상호작용할 수 있도록 합니다.
●
-v
데이터셋을 포함하는 디렉터리 등, 도커 볼륨이나 호스트 디렉터리를 컨테이너에 마운트합니다.
●
-e
환경 변수를 사용해 구성을 전달합니다. 예를 들어, 도커
docker run -e MYVARNAME=value image
는 컨테이너에
MYVARNAME
환경 변수를 생성합니다.
●
-d
컨테이너를 분리 모드에서 실행할 수 있으므로 장시간 실행되는 작업에 이상적입니다.
●
-p
외부 서비스가 네트워크를 통해 컨테이너와 상호작용할 수 있도록 호스트의 포트를 컨테이너에 전달합
니다. 예를 들어,
docker run -d -p 8080:8080 imagename
은
localhost:8080
을 컨테이너의 포
트
8080
으로 전달합니다. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.