Infra/컨테이너
Docker - 네트워크
Surge100
2022. 4. 29. 10:40
Port의 LocalHost같은 경우는 Host 컴퓨터의 몇번 port로 들어왔을 때, Container의 80port로 보낼지 지정하는 것이다. Container Port와 같은 경우는 image를 만드는 사람이 image에 설치된 프로세스에 접속할 때는 80port로 접속해야 한다고 설정을 해둔 것이기 때문에 80port로 되어있는 것이다.
Commad 환경에서 Container를 run할 때
docker run [OPTIONS] IMAGE [COMMAND] [ARG......]
docker run --name [CONTAINER_NAME] -p [HOST_PORT]_[CONTAINER_PORT] [IMAGE_NAME]
Options
--publish, -p : Publish a container's port(s)to the container