Search code examples
pythondockerflaskconnectionbamboo

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"]

Solution

  • Without seeing the docker file this looks as though the port is not open.

    • you need to explicitly expose the port via the dockerfile
    • you can change the entrypoint aswell.
    • you need to have the following in the dockerfile
    ENTRYPOINT python app.py
    EXPOSE 5000