• 0 Posts
  • 14 Comments
Joined 1 year ago
cake
Cake day: June 20th, 2023

help-circle




  • If the script is working like that it implies that your working_dir is / inside the container, hence why your python script can write to ./data instead needing to say of /data with the absolute forward slash. To my knowledge volumes cannot be mounted that way because the working directory inside the container is constantly changing, but you can set the initial working directory to /data. If you don’t want the python script inside the data folder/working directory but still want to be able to call it without specifying a path to the script you’ll need to copy it into a bin folder. So in summary you would have the script in bin, your working directory would be /data which would be associated with your machine’s directory you used when starting the docker-compose and the script would just use the path ./

    Edit: another option if you can’t change the starting working directory is simply to cd first: cd /data && yourscript