# This will fail, but is enough to demonstrate behaviour. # File just containing text "DATABASE" for now # File just containing text "TEST" for now. # This folder was created by me prior to running "docker-compose up", but is empty otherwise empty. I’ve simplified the docker-compose.yml to try to better pin-point the issue (it doesn’t appear related to multiple containers leveraging same. app_container_2/.env, etc) on my local machine. I should’ve clarified that the files were created in their respective mounts (i.e./app_container_1/.env. Will try to do this as a next step tomorrow.Īpologies, I mis-spoke. Note: I haven’t updated my Docker version yet (am on Docker version 20.10.12, docker-compose version 1.25.0). Will do some more investigation on my side and try updating Docker. That’s correct - not through /home/node/app. Also did docker inspect on my containers and can see that the propagation on volumes is rprivate (which I think is correct).īut not through the /home/node/app folder, right? app directory, so looks like it relates to submount behaviour (and not necessarily that two containers are sharing the same. The submounted files still end up in the. Thanks for this, “sub-mount” is probably the term I’m after - will do some GooglingĪs a quick test you could simply use two different bind mounts, and see if that works? If not, then I think your question need some more details. Using sub-mounts in mounts works fine with docker-ce. I’ll look into this and see if updating helps. Perhaps I’m on an older version of Docker and Docker-Compose that behaves differently (leveraging Ubuntu reps). app folder.)Ĭhanges made to those two files inside the container should be written to the bound files on the host. (Confirmed this by placing a pointless test.txt submount to /home/node/app which also appeared in my local. This is just a simple node:v16 image that runs npm run start and the software will not be creating these files (only reading). There’s no copy action within the entrypoint script. Is this a copy action within your entrypoint script? var/app/.env and /var/app/database.db), but the app does not currently have the capability to configure read from different locations (these files must be placed in the app directory).Īny help/guidance on this would be much appreciated. env and database.db in a different directory on each container (e.g. I realize this could also be resolved by mounting the. app folder on my local machine and exist isolated from each other? env and the database.db files (from Container 1 or Container 2) do not land in the. Is it possible with docker/docker-compose to make it so that the. docker/container2/database.db:/home/node/app/database.db docker/container2/.env:/home/node/app/.env app:/home/node/app # Note that this is same source mount as Container 1 docker/container1/database.db:/home/node/app/database.db docker/container1/.env:/home/node/app/.env app:/home/node/app # Note that this is same source mount as Container 2 Relevant portions of my docker-compose.yml: # Container 1 This is for a development environment (using node:v16 image) whereby I need these two containers to communicate with each other (albeit with different configurations). app volume (with one container’s configs taking precedence over the other). When launching docker-compose up, the files are being copied into the.These config files are binding into that existing ‘./app’ volume (that is shared between both containers).I have a docker-compose.yml file with two containers that share an ‘./app’ source volume that requires different config files.I’ve searched for this, but cannot seem to find an answer (my description/search term is probably poor, but I’m struggling to think of more apt phrasing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |