Home  >  Article  >  Backend Development  >  php内置的服务器启动后端口不能通过docker转换出来?

php内置的服务器启动后端口不能通过docker转换出来?

WBOY
WBOYOriginal
2016-06-06 20:19:331153browse

我做了个镜像,暴露了8000端口,容器内启动了symfony内置的服务器,端口为8000,内部访问没问题的,然后我宿主机端口8001映射到了里面的8000端口,访问说连接不上。按照我的理解,应该是可以的。

回复内容:

我做了个镜像,暴露了8000端口,容器内启动了symfony内置的服务器,端口为8000,内部访问没问题的,然后我宿主机端口8001映射到了里面的8000端口,访问说连接不上。按照我的理解,应该是可以的。

默认是监听 localhost的,你改成监听0.0.0.0

http://symfony.com/doc/current/cookbook/web_server/built_in.html

$ php bin/console server:start 0.0.0.0:8000
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn