首页 > 解决方案 > Bamboo - Docker image run Error - Connection refused

问题描述

I am using bamboo to run the python application(Flask app). And successfully check out the source code from repository and created docker image using bamboo itself. And tried to run the image using bamboo docker task got below Connection refused error. How do I solve this issue.

Failed connecting to http://localhost:5000, error: Connection refused (Connection refused)
    Attempting connection to http://localhost:5000
     Failed connecting to http://localhost:5000,  error: Connection refused (Connection refused)
    Attempting connection to http://localhost:5000
    Failed connecting to http://localhost:5000, error: Connection refused (Connection refused)
    Attempting connection to http://localhost:5000
    Failed connecting to http://localhost:5000, error: Connection refused (Connection refused)
    Attempting connection to http://localhost:5000
    Failed connecting to http://localhost:5000, error: Connection refused (Connection refused)

Docker file:

FROM python
COPY . /app
WORKDIR /app
RUN pip install -r python_modules.txt
ENTRYPOINT ["python"]
CMD ["app.py"]

标签: pythondockerflaskconnectionbamboo

解决方案


没有看到 docker 文件,这看起来好像端口没有打开。

  • 您需要通过 dockerfile 显式公开端口
  • 您也可以更改入口点。
  • 您需要在 dockerfile 中有以下内容
ENTRYPOINT python app.py
EXPOSE 5000

推荐阅读