I'm new to Docker and trying to understand how to use bind mounts with Python scripts. I'm using a Mac running Catalina (10.15.7). I have a Python script that I normally start with a local config.ini file containing settings that control the script. I'd like to run the Python script in a Docker container but have it access the config file from my local machine.
My local directory contains the Dockerfile, requirements.txt file , config.ini file, and a subdirectory (src) with my python files. The Dockerfile used to build the image is as follows:
FROM python:3.7
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY src/ .
CMD ["python", "./main.py" ]
After I build the image, I run it with the following command:
docker container run -v $(pwd):/app image_name
which results in the error can't open file './main.py'
Suggestions?