Hi, I am new to Docker. I created an image for a streamlit-based chatbot app, and pushed it to docker hub repository. Initially I had created a repository but due to name mismatch, it was uploaded to a new repository that Docker Hub created. I then deleted the local copy of the image and pulled the image from the repository.
Now when I was running the image locally in my device using docker compose up, it was working fine. I did not use docker build command as it was an app with several depencies, one of which was the .env file.
Now after pulling the image from the hub and trying to run it, it is unable to detect the API credentials from the .env file. i am not sure what to do, as I had written both the Dockerfile and the docker-compose.yml files correctly. I have pasted the codes here.
Dockerfile:
FROM python:3.13-slim
# Prevent Python from writing .pyc files and enable unbuffered logs
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Install system deps (minimal; enough for common Python wheels)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY . .
# Streamlit port
EXPOSE 8501
# Run Streamlit app (Change final.py if your module/object is different)
CMD ["streamlit", "run", "final.py", "--server.port=8501", "--server.address=0.0.0.0"]
docker-compose:
services:
streamlit:
image: forwardair-streamlit:latest
build: .
container_name: forwardair-streamlit
ports:
- "8501:8501"
env_file:
- .env
volumes:
# Persist FAISS index between runs (optional, but useful)
- ./faiss_index:/app/faiss_index
restart: unless-stopped
Please help me resolve this issue. Thanks!
EDIT: It is also happening when I use Azure Content Registry