What is in this folder: /mnt/user/appdata/guide2go2/ ?
Because, since you mount this into the container, then the host is the “master” and the original content of /config will be overwritten
Yes there is! I guess you have a entrypoint or cmd defined.
You can as a entrypoint script, make it cp the file from a temp location, to the /config folder.
The entrypoint script will then copy the file when the container starts
i would make a script, that copies the file, and then just executes the command you need to run in the foreground ( in this case cron ) as the last thing the script does
currently i have a entrypoint script like this and looking ok so far
may u have a hint howto do it better the cron as last job … i tried but didnt really work out.
currently i use tail -f /dev/null
#!/bin/bash
FILE=/scripts/guide2go.sh
if [ -f “$FILE” ]; then
echo “$FILE exist”
else
echo “$FILE does not exist”
mv /guide2go.sh /scripts/guide2go.sh
chmod +x /scripts/guide2go.sh
chmod 777 /scripts/guide2go.sh
fi
Terpz actualy propses a universal and predictable solution to handle the issue.
Please consider the next senteces as FYI:
There are differences in how bind and named volumes treat the original content of the target folder.
– bind: the content of the source folder will be mounted into the target folder and its original becomes invisible to the container. A bind neither creates nor requires a volume.
– named volume: the content of the orignal target folder is copied into the volume. It needs to be declared in a docker-compose.yml or created from the cli before its uage. Named volumes can be bind (of local folders), nfs-shares, cifs-shares or whatever the volume plugins you install allow.
Espacly the named volume solution is often a surprise for users… stick with what Terpz proposed.