How to publish ports in docker files

后端 未结 4 2103
有刺的猬
有刺的猬 2021-02-03 21:45

I need to map the ports on the host to the ports on the container. I can achieve this by running the \"docker run\" command with the -p option. How do

4条回答
  •  青春惊慌失措
    2021-02-03 22:03

    1. EXPOSE a list of ports on your Dockerfile.

    2. Run docker run -d -P --name app_name app_image_name.

    3. After the previous steps succeed,

      run docker port app_name which will display you an output like below:

      80/tcp -> 0.0.0.0:32769 443/tcp -> 0.0.0.0:32768

提交回复
热议问题