Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

Docker not mounting properly when using docker run

$
0
0

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_nameMy 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"]

Viewing all articles
Browse latest Browse all 5962

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>