简体   繁体   English

如何为dockerized Rasa-NLU配置要公开的端口

[英]How to configure the port to be exposed for dockerized Rasa-NLU

I'm new with Rasa and docker. 我是Rasa和docker的新手。 My attempt to dockerize Rasa-NLU consists of the below steps: Instructions were referred from here 我对Rasa-NLU进行docker化的尝试包括以下步骤: 此处引用了说明

  1. Did a Git clone of latest Rasa-NLU 克隆了最新的Rasa-NLU的Git
  2. Copied Dockerfile_full (from within /docker ) to the root directory Dockerfile_full复制(从/docker Dockerfile_full内部)到根目录
  3. Changed the port number specified in config_default.json and Dockerfile_full from default(5000) to 5048. 改变在指定的端口号config_default.jsonDockerfile_full从默认值(5000)到5048。
  4. Build using: docker build -t rasa_nlu . 使用docker build -t rasa_nlu .

  5. Run the docker on a port(5048) different from the default(5000) port. 在不同于默认端口(5000)的端口(5048)上运行docker。

However, the following gets logged in the console: 但是,以下内容将记录在控制台中:

INFO:rasa_nlu.data_router:Logging requests to '/app/logs/rasa_nlu_log-20170928-091903-1.log'. INFO:__main__:Started http server on port 5000 2017-09-28 09:19:03+0000 [-] Log opened. 2017-09-28 09:19:03+0000 [-] Site starting on 5000 2017-09-28 09:19:03+0000 [-] Starting factory <twisted.web.server.Site instance at 0x7fbab0bfdd40> INFO:__main__:Started http server on port 5000 2017-09-28 09:19:03+0000 [-] Log opened. 2017-09-28 09:19:03+0000 [-] Site starting on 5000 2017-09-28 09:19:03+0000 [-] Starting factory <twisted.web.server.Site instance at 0x7fbab0bfdd40> INFO:__main__:Started http server on port 5000 2017-09-28 09:19:03+0000 [-] Log opened. 2017-09-28 09:19:03+0000 [-] Site starting on 5000 2017-09-28 09:19:03+0000 [-] Starting factory <twisted.web.server.Site instance at 0x7fbab0bfdd40> 2017-09-28 09:19:03+0000 [-] Log opened. 2017-09-28 09:19:03+0000 [-] Site starting on 5000 2017-09-28 09:19:03+0000 [-] Starting factory <twisted.web.server.Site instance at 0x7fbab0bfdd40>

If I try to hit the Rasa endpoint locally using CURL, I get a connection reset error. 如果尝试使用CURL在本地访问Rasa端点,则会收到connection reset错误。 My doubts of a wrong port being referred were confirmed when checked within docker container (using docker exec )it was running on port 5000. 当我在docker容器(使用docker exec )中检查它正在端口5000上运行时,确认了我对引用错误端口的怀疑。

Can someone help me out here as to where exactly I'm going wrong and where should the port number be configured ? 有人可以在这里帮我解决我到底要去哪里以及应该在哪里配置端口号吗?

Thanks in advance! 提前致谢!

Dockerfile_full expects the config file to be in the sample_configs folder. Dockerfile_full希望配置文件位于sample_configs文件夹中。 Also Dockerfile_full uses the config_spacy_duckling.json config file. Dockerfile_full也使用config_spacy_duckling.json配置文件。 So make sure you replace the below reference in the dockerfile. 因此,请确保在dockerfile中替换以下参考。 You can either change the config file it copies in or change the port configuration in the correct file. 您可以更改其复制到其中的配置文件,也可以更改正确文件中的端口配置。

COPY sample_configs/config_spacy_duckling.json ${RASA_NLU_HOME}/config.json

Ignoring that, why change the port in both locations? 忽略这一点,为什么要在两个位置都更改端口? All you need to do is change it in your docker run or compose command. 您需要做的就是在docker run或compose命令中对其进行更改。

docker run -p 5048:5000 rasa/rasa_nlu:latest-full

Add and change port in sample_configs/config_spacy_duckling.json . sample_configs/config_spacy_duckling.json添加和更改端口。 If you see the Dockerfile this the config that is copied and it has no port defined. 如果您看到Dockerfile ,将复制配置,并且未定义端口。 So once you put port in this and build it would work 因此,一旦您将端口放入其中并进行构建,便可以使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM