Chatbot generates answers very late when executing it in the Docker container running in my computer compare to the chatbot execution without docker

I want know ‘Why my chatbot generates and types the answer of each question very late than the normal one? I explain you more in detail below:

I have created the chatbot application which has below dependencies:

python 3.10.10
ollama 0.3.6 (https://ollama.com/)
chromadb==0.5.3
streamlit==1.36.0
langchain_core==0.2.9
langchain_community==0.2.5
PyPDF2
pypdf==4.2.0
langdetect==1.0.9

Since my goal is to run the application on the server, I have done the Docker Containerization. For that, I have created the Dockerfile, docker-compose.yml and start.sh.

  • Dockerfile is containing all dependencies installing process, exposing chatbot ports and so on.
  • docker-compose.yml contains the combination of two services. One for Ollama Container and Second for chatbot application. In Ollama Service, the file start.sh also gets executed.
  • start.sh contains the name of the Ollama (which starts the Ollama service inside the container), Ollama models and they are going to be pulled which execution of the start.sh file.

At the end, on my local computer, when I execute the command docker-compose up --build, it executes the containerization process, installs Ollama, start the ollama server and pull ollama models inside the docker container. At the end of the process, I open http://localhost:8501 to start the chatbot application. Then I upload the document, write the question and hit enter to get the answer.

About the Answer: I have recieved the answer of a respective question after very long time compare to the scenario where I use the chatbot application on my local computer without the docker container. This is a bit wierd to me.

Why I am receiving answers very late when I execute the answer very late while executing the application on the docker container in compare to the application execution without the docker container.

For your reference, I have added my docker.compose.yml file as below:

services:
  ollama:
    container_name: ollama_v5
    image: ollama/ollama:latest
    restart: unless-stopped
    volumes:
      - "./ollamadata:/root/.ollama"
      - "./start.sh:/start.sh"  # Mount the script into the container
    ports:
      - "11434:11434"
    entrypoint: /start.sh
    networks:
      - ollama_network

  chatbot:
    container_name: chatbot_v5
    build:
      context: ./    # The directory where Dockerfile and code are located
      dockerfile: Dockerfile
    restart: unless-stopped
    environment:
      - BASE_URL=http://ollama:11434     # Chatbot will access the Ollama API
    ports:
      - "8501:8501"                      
    depends_on:
      - ollama
    networks:
      - ollama_network

networks:
  ollama_network:
    driver: bridge

2

Do you have any specific options for limit resources?
Something like:

  resources:
    limits:
      cpus: '0.5'       # Limit to 50% of one CPU
      memory: 512M      # Limit to 512 MB of memory

If you want try to set container in privileged mode:

services:
  my_service:
    image: my_image
    privileged: true  # Enable privileged mode for the container

If this is not helping you maybe have some problems in the docker bridge network

7

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Chatbot generates answers very late when executing it in the Docker container running in my computer compare to the chatbot execution without docker

I want know ‘Why my chatbot generates and types the answer of each question very late than the normal one? I explain you more in detail below:

I have created the chatbot application which has below dependencies:

python 3.10.10
ollama 0.3.6 (https://ollama.com/)
chromadb==0.5.3
streamlit==1.36.0
langchain_core==0.2.9
langchain_community==0.2.5
PyPDF2
pypdf==4.2.0
langdetect==1.0.9

Since my goal is to run the application on the server, I have done the Docker Containerization. For that, I have created the Dockerfile, docker-compose.yml and start.sh.

  • Dockerfile is containing all dependencies installing process, exposing chatbot ports and so on.
  • docker-compose.yml contains the combination of two services. One for Ollama Container and Second for chatbot application. In Ollama Service, the file start.sh also gets executed.
  • start.sh contains the name of the Ollama (which starts the Ollama service inside the container), Ollama models and they are going to be pulled which execution of the start.sh file.

At the end, on my local computer, when I execute the command docker-compose up --build, it executes the containerization process, installs Ollama, start the ollama server and pull ollama models inside the docker container. At the end of the process, I open http://localhost:8501 to start the chatbot application. Then I upload the document, write the question and hit enter to get the answer.

About the Answer: I have recieved the answer of a respective question after very long time compare to the scenario where I use the chatbot application on my local computer without the docker container. This is a bit wierd to me.

Why I am receiving answers very late when I execute the answer very late while executing the application on the docker container in compare to the application execution without the docker container.

For your reference, I have added my docker.compose.yml file as below:

services:
  ollama:
    container_name: ollama_v5
    image: ollama/ollama:latest
    restart: unless-stopped
    volumes:
      - "./ollamadata:/root/.ollama"
      - "./start.sh:/start.sh"  # Mount the script into the container
    ports:
      - "11434:11434"
    entrypoint: /start.sh
    networks:
      - ollama_network

  chatbot:
    container_name: chatbot_v5
    build:
      context: ./    # The directory where Dockerfile and code are located
      dockerfile: Dockerfile
    restart: unless-stopped
    environment:
      - BASE_URL=http://ollama:11434     # Chatbot will access the Ollama API
    ports:
      - "8501:8501"                      
    depends_on:
      - ollama
    networks:
      - ollama_network

networks:
  ollama_network:
    driver: bridge

2

Do you have any specific options for limit resources?
Something like:

  resources:
    limits:
      cpus: '0.5'       # Limit to 50% of one CPU
      memory: 512M      # Limit to 512 MB of memory

If you want try to set container in privileged mode:

services:
  my_service:
    image: my_image
    privileged: true  # Enable privileged mode for the container

If this is not helping you maybe have some problems in the docker bridge network

7

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật