I am using an ubuntu 22.04 LTS server to try and run my python script. After creating the image, I use this command:docker run -d --shm-size=5g -v /home/scripts/project:/home/scripts/project image_name
My script reads and writes to a csv file. It seems to work until I restart it, since when I do the csv file seems to get deleted. I'm trying to mount it with -v so when the script reads or writes to the csv file, I can see the changes when I read the csv file in the directory, for example if I use cat
. However, the csv file always seems to be empty, even with my attempt at mounting the container and after I know my program has made changes to the csv file. How do I change my run command so the script writes to the csv file in the directory that I specified?
Here's the dockerfile that I use to create the image:
FROM python:3.11WORKDIR /appCOPY . /appENV TZ="America/Los_Angeles"RUN pip install --trusted-host pypi.python.org -r requirements.txtRUN apt-get update && \ apt-get install -y wget unzipRUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \ apt install -y ./google-chrome-stable_current_amd64.deb && \ rm google-chrome-stable_current_amd64.debRUN apt-get cleanCMD ["python3.11", "-u", "bot.py"]