I'm setting up a vscode dev container that uses docker-compose. I need to initalize a replica set in mongo which uses a 2nd setup container that needs a bash script.
My directory structure is:
.devcontainer
scripts
mongosetup.sh
I'm then mounting the scripts directory to my container:
mongodb-setup:
image: mongo
volumes:
- ./scripts:/scripts
command: "ls -la /scripts"
depends_on:
- mongodb
Checking the output from this container, the ls -la /scripts command shows that mongosetup.sh has been made a folder so I can't run it...
total 4
drwxr-xr-x 3 root root 60 Jun 14 02:29 .
drwxr-xr-x 1 root root 4096 Jun 14 03:25 ..
drwxr-xr-x 2 root root 40 Jun 14 02:29 mongosetup.sh
I've tried mounting just the file and my volume as ".scripts:/scripts".
I should note that this only happens when using "Clone repository in Container volume". If I clone the repo to my computer, than open it in VS code and build it from there it works fine.
My devcontainer is setup to go into my mongodb image. It has access to my files in /workspaces/REPONAME and if I check it there the file is not a folder: