Docker -p的问题
怪我咯
怪我咯 2017-04-27 09:01:48
0
3
830

1: docker run -d -p 3000:3000 images
这里若在container内开启localhost:3000的服务,怎么才能从外部访问呢?浏览器地址是什么?

2:我commit了一个已经部署好环境的image,当下次我根据imagerun一个container,为什么一些shell还需要source才能生效,之前已经source过了。
web服务也需要重新开启。
不是使用Dockerfile生成的image.

3:根据Dockerfilebuild成的image,是不是在run时会执行内部的ENTRYPOINT,所以一些服务不需要重新开启。

谢谢!!

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all (3)
Peter_Zhu

Question 2:
You should just put the operation in the script that is executed when running. The source seems to have to be executed every time it is started. In Linux, files in some locations will be automatically sourced

Question 3:
ENTRYPOINT is executed when the container starts, regardless of whether there is a CMD command. Services and other things are generally started in this script.

    我想大声告诉你
    1. The browser address is 127.0.0.1:3000

    2. The source command is a one-time import. It will be removed from the environment variables when you exit the terminal. Next time you start the terminal, re-import it

    3. You can specify any shell command or script for the RUN command of Dockerfile

      某草草

      Question 1:
      container内需要 listening0.0.0.0:3000而不是127.0.0.1:3000

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!