It's probably a very simple thing. I just can't seem to get an answer by googling. I keep getting error when using Docker-Compose to mount a folder 2 level down of my current folder as a volume into a container.
I'm running Docker on Windows 10. I got two containers. The first one does some web scraping and generates a table in html and dump it into the mounted volume. The 2nd container runs flask and present the html through web portal.
By default the flask container loads html files from its templates
folder. So for the scraper container, I tries to mount a volume points to that templates
folder. But as soon as I put more than 2 levels of path in the mount path, the container will just fail to run with this error:
invalid mount config for type "volume": invalid mount path: 'static' mount path must be absolute
I then tried put in the absolute path as indicated, but getting the same error.
volumes:
- 'C:/shared/project/testProject/webfront/templates:/usr/src/app/data'
Here is docker-compose file snippet
scraper:
build: './scraper'
env_file:
- '.env'
volumes:
- './webfront/templates:/usr/src/app/data'
Here's the folder structure
./
├───scraper
└───webfront
├───templates
I have tested mounting the volume with docker run command, and was able to mount the volume successfully after provided the absolute path. So it appears this is an issue/bug to do with docker-compose only. I will try raise a issue in their Github repo.