Hello,
I am new to docker. I am trying to run a yml file and its working as expected. However I can see a python process running flask. When I bring down the docker the host python also stops. Is this normal behaviour ? Here is yml file
Note : I am using “docker compose up build” nor “docker-compose”
version: '3.8'
services:
bc365mw_v2:
build: .
ports:
- "50001:5000"
volumes:
- .:/app
command: flask run --host=0.0.0.0
depends_on:
- mysql
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: <pwd>
MYSQL_DATABASE: caredb
ports:
- "3306:3306"
volumes:
- mysql-data:/var/lib/mysql
volumes:
mysql-data:
and Dockerfile for build app is as follows
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Make port 5000 available to the world outside this container
EXPOSE 5000
# Define environment variable for Flask
ENV FLASK_APP=app.py
# Run app.py when the container launches
CMD ["flask", "run", "--host=0.0.0.0"]
Thanks in advance. Pls pardon if it is a basic qz. I am just starting on docker.
Prem